summaryrefslogtreecommitdiffstats
path: root/src/libcola/cola.h
diff options
context:
space:
mode:
authorTim Dwyer <tgdwyer@gmail.com>2006-07-16 13:48:42 +0000
committertgdwyer <tgdwyer@users.sourceforge.net>2006-07-16 13:48:42 +0000
commit07c4a573fb37123709d30ee7a6cc15c9bb15925c (patch)
tree95bba7018c2fe57f83a266c408738d1e33ee838b /src/libcola/cola.h
parentadded inkscape_get_all_desktops() after speaking with Dale about his plans fo... (diff)
downloadinkscape-07c4a573fb37123709d30ee7a6cc15c9bb15925c.tar.gz
inkscape-07c4a573fb37123709d30ee7a6cc15c9bb15925c.zip
Layout algorithm is now applied to each connected component in the
selection separately. Previously, behaviour of layout on disconnected graphs was... undefined! (bzr r1421)
Diffstat (limited to 'src/libcola/cola.h')
-rw-r--r--src/libcola/cola.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/libcola/cola.h b/src/libcola/cola.h
index cc99515bf..e0cf1257c 100644
--- a/src/libcola/cola.h
+++ b/src/libcola/cola.h
@@ -17,9 +17,24 @@
typedef vector<unsigned> Cluster;
typedef vector<Cluster*> Clusters;
+using vpsc::Rectangle;
+
namespace cola {
typedef pair<unsigned, unsigned> Edge;
+ // a graph component with a list of node_ids giving indices for some larger list of nodes
+ // for the nodes in this component, and a list of edges - node indices relative to this component
+ struct Component {
+ vector<unsigned> node_ids;
+ vector<Rectangle*> rects;
+ vector<Edge> edges;
+ };
+ // for a graph of n nodes, return connected components
+ void connectedComponents(
+ vector<Rectangle*> &rs,
+ vector<Edge> &es,
+ vector<Component*> &components);
+
// defines references to three variables for which the goal function
// will be altered to prefer points u-b-v are in a linear arrangement
// such that b is placed at u+t(v-u).
@@ -121,7 +136,7 @@ namespace cola {
class ConstrainedMajorizationLayout {
public:
ConstrainedMajorizationLayout(
- vector<vpsc::Rectangle*>& rs,
+ vector<Rectangle*>& rs,
vector<Edge>& es,
double* eweights,
double idealLength,
@@ -141,7 +156,7 @@ namespace cola {
straightenEdges(NULL)
{
assert(rs.size()==n);
- boundingBoxes = new vpsc::Rectangle*[rs.size()];
+ boundingBoxes = new Rectangle*[rs.size()];
copy(rs.begin(),rs.end(),boundingBoxes);
double** D=new double*[n];
@@ -229,7 +244,7 @@ namespace cola {
double** Dij;
double tol;
TestConvergence& done;
- vpsc::Rectangle** boundingBoxes;
+ Rectangle** boundingBoxes;
double *X, *Y;
Clusters* clusters;
double edge_length;