|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r79841 - in sandbox/icl/libs/xplore/br1/sqlbrowser: . Dag
From: afojgo_at_[hidden]
Date: 2012-08-02 02:08:16
Author: jofaber
Date: 2012-08-02 02:08:14 EDT (Thu, 02 Aug 2012)
New Revision: 79841
URL: http://svn.boost.org/trac/boost/changeset/79841
Log:
Depth first search of dag to construct QTreeModel.
Added:
sandbox/icl/libs/xplore/br1/sqlbrowser/objects1_abbeyRd.db (contents, props changed)
Binary files modified:
sandbox/icl/libs/xplore/br1/sqlbrowser/objects1.db
Text files modified:
sandbox/icl/libs/xplore/br1/sqlbrowser/CreatorVisitor2.h | 3 ---
sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/DbBasedGraph.h | 37 +++++++++++++++++++++++++++++++++----
sandbox/icl/libs/xplore/br1/sqlbrowser/StringVisitor2.h | 2 +-
sandbox/icl/libs/xplore/br1/sqlbrowser/browser.cpp | 4 ++--
sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.h | 2 --
5 files changed, 36 insertions(+), 12 deletions(-)
Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/CreatorVisitor2.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/CreatorVisitor2.h (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/CreatorVisitor2.h 2012-08-02 02:08:14 EDT (Thu, 02 Aug 2012)
@@ -34,9 +34,6 @@
OnDiscoverVertex(DagItem* curItem, QString* result, Vertex2AttributesMap& attrs)
: p_curItem(curItem), p_result(result), r_attrs(attrs)
{
- //JODO redundant?
- r_attrs[0].setDagItem(p_curItem); //Root node
- r_attrs[0].setParentItem(0); //Root node
}
typedef boost::on_discover_vertex event_filter;
Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/DbBasedGraph.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/DbBasedGraph.h (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/DbBasedGraph.h 2012-08-02 02:08:14 EDT (Thu, 02 Aug 2012)
@@ -136,15 +136,19 @@
tString depthFirstString()
{
+ typedef DbBasedGraph::vertex_descriptor vertex_descriptor;
//Add an associative color map type.
- typedef std::map<DbBasedGraph::vertex_descriptor, boost::default_color_type> color_map_t;
+ typedef std::map<vertex_descriptor, boost::default_color_type> color_map_t;
color_map_t color_map; //Declare a container
tVertex2Depth vertexDepth;
QString tygraAsString;
+ vertex_descriptor start_vertex;
BGL_FORALL_VERTICES(vtx, m_aGraph, DbBasedGraph) {
color_map[vtx] = boost::white_color;
+ if(m_aGraph[vtx].key() == 32)
+ start_vertex = vtx;
}
//Generate an assoc property map
@@ -160,7 +164,7 @@
)
)
, pm_color
- , 15
+ , start_vertex
);
@@ -169,19 +173,44 @@
tString makeDagModel(DagModel2* dagmo)
{
+ typedef DbBasedGraph::vertex_descriptor vertex_descriptor;
+ //Add an associative color map type.
+ typedef std::map<vertex_descriptor, boost::default_color_type> color_map_t;
+ color_map_t color_map; //Declare a container
+
CreatorVisitor2<DbBasedGraph>::Vertex2AttributesMap vertex2AttrMap;
QString graphAsString;
DagItem* modelRoot = dagmo->rootItem();
+ vertex_descriptor start_vertex;
+
+ BGL_FORALL_VERTICES(vtx, m_aGraph, DbBasedGraph) {
+ color_map[vtx] = boost::white_color;
+ if(m_aGraph[vtx].key() == 32)
+ start_vertex = vtx;
+ }
+
+
+ modelRoot->setData(dag::node::posId, QVariant(m_aGraph[start_vertex].key()));
+ modelRoot->setData(dag::node::posName, QVariant(m_aGraph[start_vertex].name()));
+
+ vertex2AttrMap[start_vertex].setDagItem(modelRoot);
+ vertex2AttrMap[start_vertex].setParentItem(0); //Root has no parent.
+
+ //Generate an assoc property map
+ boost::associative_property_map<color_map_t> pm_color(color_map);
+
boost::depth_first_search(
m_aGraph
- , boost::visitor(make_dfs_visitor(boost::make_list(
+ , make_dfs_visitor(boost::make_list(
CreatorVisitor2<DbBasedGraph>::OnDiscoverVertex (modelRoot, &graphAsString, vertex2AttrMap)
, CreatorVisitor2<DbBasedGraph>::OnExamineEdge (modelRoot, &graphAsString, vertex2AttrMap)
// , CreatorVisitor2<DbBasedGraph>::OnForwardOrCrossEdge(modelRoot, &graphAsString, vertex2AttrMap)
, CreatorVisitor2<DbBasedGraph>::OnFinishVertex (modelRoot, &graphAsString, vertex2AttrMap)
)
- ))
+ )
+ , pm_color
+ , start_vertex
);
return graphAsString;
Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/StringVisitor2.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/StringVisitor2.h (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/StringVisitor2.h 2012-08-02 02:08:14 EDT (Thu, 02 Aug 2012)
@@ -35,7 +35,7 @@
{ //MEMO in_degree(node, graph) == ingoing node count | only for BiDiectionalGraph
*p_result += indentation(depth(node))
+ "(" + QString("*%1 ").arg(boost::out_degree(node, graph))
- + QString("%1 ").arg(graph[node].key());
+ + QString("%1|%2 ").arg(node).arg(graph[node].key());
*p_result += graph[node].name();
*p_result += "\n";
}
Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/browser.cpp
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/browser.cpp (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/browser.cpp 2012-08-02 02:08:14 EDT (Thu, 02 Aug 2012)
@@ -252,8 +252,8 @@
//--------------------------------------------------------------------------
DagModel2* dagmo = new DagModel2(); // Dag-Model
- //QString dbg_dagString = ogra.makeDagModel(dagmo);
- //util::launchMsgBox(dbg_dagString);
+ QString dbg_dagString = ogra.makeDagModel(dagmo);
+ util::launchMsgBox(dbg_dagString);
//dagmo->setDag(ogra); //Make the Model from a boost::graph internally
//dagmo->makeDagModel();
//--------------------------------------------------------------------------
Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.h (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/dagmodel.h 2012-08-02 02:08:14 EDT (Thu, 02 Aug 2012)
@@ -21,8 +21,6 @@
-typedef std::map<int, int> daggy; //CL?
-
class QSqlQuery;
class DagItem;
Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/objects1.db
==============================================================================
Binary files. No diff available.
Added: sandbox/icl/libs/xplore/br1/sqlbrowser/objects1_abbeyRd.db
==============================================================================
Binary file. No diff available.
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk