diff options
| author | Tim Dwyer <tgdwyer@gmail.com> | 2006-07-14 04:09:40 +0000 |
|---|---|---|
| committer | tgdwyer <tgdwyer@users.sourceforge.net> | 2006-07-14 04:09:40 +0000 |
| commit | d18b8150ba16f4a930b213dae1f4fb369cb3d0bf (patch) | |
| tree | 72afddfbcafd6b51e6797a7674c963886cce75b0 /src/libvpsc/block.cpp | |
| parent | * src/libavoid/router.cpp: Fixed a bug in the libavoid function (diff) | |
| download | inkscape-d18b8150ba16f4a930b213dae1f4fb369cb3d0bf.tar.gz inkscape-d18b8150ba16f4a930b213dae1f4fb369cb3d0bf.zip | |
- Connectors with end-markers now constrained to point downwards in graph layout
- vpsc namespace added to libvpsc
(bzr r1408)
Diffstat (limited to 'src/libvpsc/block.cpp')
| -rw-r--r-- | src/libvpsc/block.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libvpsc/block.cpp b/src/libvpsc/block.cpp index 69a439cd7..221df536a 100644 --- a/src/libvpsc/block.cpp +++ b/src/libvpsc/block.cpp @@ -23,6 +23,7 @@ using std::endl; #endif using std::vector; +namespace vpsc { void Block::addVariable(Variable* const v) { v->block=this; vars->push_back(v); @@ -346,6 +347,22 @@ void Block::populateSplitBlock(Block *b, Variable* const v, Variable* const u) { populateSplitBlock(b, (*c)->right, v); } } +// Search active constraint tree from u to see if there is a directed path to v. +// Returns true if path is found with all constraints in path having their visited flag +// set true. +bool Block::isActiveDirectedPathBetween(Variable* u, Variable *v) { + if(u==v) return true; + for (Cit c=u->out.begin();c!=u->out.end();++c) { + if(canFollowRight(*c,NULL)) { + if(isActiveDirectedPathBetween((*c)->right,v)) { + (*c)->visited=true; + return true; + } + (*c)->visited=false; + } + } + return false; +} /** * Block needs to be split because of a violated constraint between vl and vr. * We need to search the active constraint tree between l and r and find the constraint @@ -402,3 +419,4 @@ ostream& operator <<(ostream &os, const Block& b) } return os; } +} |
