From: tgdwyer Date: Mon, 13 Feb 2006 05:05:50 +0000 (+0000) Subject: ifdefs X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8da35fd7d6ccd15ed4a7c674530c733b0a820bca;p=inkscape.git ifdefs --- diff --git a/src/graphlayout/graphlayout.cpp b/src/graphlayout/graphlayout.cpp index dff414895..480fe5f95 100644 --- a/src/graphlayout/graphlayout.cpp +++ b/src/graphlayout/graphlayout.cpp @@ -29,7 +29,6 @@ #include #include #include -#include using namespace boost; // create a typedef for the Graph type @@ -39,7 +38,6 @@ typedef property_map::type WeightMap; typedef graph_traits::vertex_descriptor Vertex; typedef std::vector > PositionVec; typedef iterator_property_map::type> PositionMap; -#endif // HAVE_BOOST_GRAPH_LIB bool isConnector(SPItem *i) { SPPath *path = NULL; @@ -48,6 +46,7 @@ bool isConnector(SPItem *i) { } return path && path->connEndPair.isAutoRoutingConn(); } +#endif // HAVE_BOOST_GRAPH_LIB /** * Takes a list of inkscape items, extracts the graph defined by * connectors between them, and uses graph layout techniques to find @@ -64,16 +63,13 @@ void graphlayout(GSList const *const items) { std::list selected; selected.insert >(selected.end(), items, NULL); if (selected.empty()) return; - int n=selected.size(); - - //Check 2 or more selected objects - if (n < 2) return; Graph g; double minX=DBL_MAX, minY=DBL_MAX, maxX=-DBL_MAX, maxY=-DBL_MAX; std::map nodelookup; + std::vector labels; for (std::list::iterator it(selected.begin()); it != selected.end(); ++it) @@ -82,9 +78,14 @@ void graphlayout(GSList const *const items) { if(!isConnector(u)) { std::cout<<"Creating node for id: "<id<id]=add_vertex(g); + labels.push_back(u->id); } } + int n=labels.size(); + //Check 2 or more selected objects + if (n < 2) return; + WeightMap weightmap=get(edge_weight, g); int i=0; for (std::list::iterator it(selected.begin()); @@ -124,7 +125,7 @@ void graphlayout(GSList const *const items) { std::cout<<"Graph has |V|="<