From 362df4dbefa539349b4815e28a1423292a43637a Mon Sep 17 00:00:00 2001 From: tgdwyer Date: Mon, 13 Feb 2006 04:13:07 +0000 Subject: [PATCH] added isConnector function --- src/graphlayout/graphlayout.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/graphlayout/graphlayout.cpp b/src/graphlayout/graphlayout.cpp index a99fdd720..238b39a23 100644 --- a/src/graphlayout/graphlayout.cpp +++ b/src/graphlayout/graphlayout.cpp @@ -41,6 +41,13 @@ typedef std::vector > PositionVec; typedef iterator_property_map::type> PositionMap; #endif // HAVE_BOOST_GRAPH_LIB +bool isConnector(SPItem *i) { + SPPath *path = NULL; + if(SP_IS_PATH(i)) { + path = SP_PATH(i); + } + return path && path->connEndPair.isAutoRoutingConn(); +} /** * Takes a list of inkscape items, extracts the graph defined by * connectors between them, and uses graph layout techniques to find @@ -73,12 +80,7 @@ void graphlayout(GSList const *const items) { { SPItem *u=*it; std::cout<<"id:"<id<connEndPair.isAutoRoutingConn(); - if(!isConn) { + if(!isConnector(u)) { std::cout<<" is a node."<id]=add_vertex(g); } @@ -139,7 +141,7 @@ void graphlayout(GSList const *const items) { ++it) { SPItem *u=*it; - if(strncmp(u->id,"path",4)) { + if(!isConnector(u)) { NR::Rect const item_box(sp_item_bbox_desktop(u)); NR::Point const curr(item_box.midpoint()); NR::Point const dest(minX+width/2.0+position[nodelookup[u->id]].x, -- 2.30.2