23 #ifndef COLA_CLUSTER_H 24 #define COLA_CLUSTER_H 28 #include "libvpsc/rectangle.h" 29 #include "libvpsc/variable.h" 31 #include "libcola/compound_constraints.h" 32 #include "libcola/commondefs.h" 33 #include "libcola/box.h" 34 #include "libcola/shapepair.h" 39 typedef std::vector<Cluster *> Clusters;
40 typedef std::vector<Clusters> ClustersList;
87 void unsetDesiredBounds();
90 virtual void printCreationCode(FILE *fp)
const = 0;
91 virtual void countContainedNodes(std::vector<unsigned>& counts);
92 virtual bool clusterIsFromFixedRectangle(
void)
const;
93 virtual void outputToSVG(FILE *fp)
const = 0;
111 unsigned clusterVarId;
114 double internalEdgeWeightFactor;
115 std::set<unsigned> nodes;
116 std::vector<Cluster*> clusters;
117 std::valarray<double> hullX, hullY;
121 Clusters currentPath);
122 bool includesAllNodesFrom(
const Cluster *rhs)
const;
135 std::set<ShapePair> m_cluster_cluster_overlap_exceptions;
136 std::map<unsigned, Cluster *> m_overlap_replacement_map;
137 std::set<unsigned> m_nodes_replaced_with_clusters;
143 bool desiredBoundsSet;
179 bool flat(
void)
const 181 return clusters.empty();
183 virtual void printCreationCode(FILE *fp)
const;
184 virtual void outputToSVG(FILE *fp)
const;
202 void calculateClusterPathsToEachNode(
size_t nodesCount);
207 bool m_allows_multiple_parents;
209 std::vector<ClustersList> m_cluster_vectors_leading_to_nodes;
300 virtual void countContainedNodes(std::vector<unsigned>& counts);
301 virtual void printCreationCode(FILE *fp)
const;
302 virtual void outputToSVG(FILE *fp)
const;
307 if (minEdgeRect[dim])
309 delete minEdgeRect[dim];
314 double edgePosition = minEdgeRect[dim]->getMinD(dim);
315 minEdgeRect[dim]->setMinD(dim, edgePosition - m_margin.min(dim));
316 minEdgeRect[dim]->setMaxD(dim, edgePosition);
318 return minEdgeRect[dim];
323 if (maxEdgeRect[dim])
325 delete maxEdgeRect[dim];
330 double edgePosition = maxEdgeRect[dim]->getMaxD(dim);
331 maxEdgeRect[dim]->setMaxD(dim, edgePosition + m_margin.max(dim));
332 maxEdgeRect[dim]->setMinD(dim, edgePosition);
334 return maxEdgeRect[dim];
336 virtual bool clusterIsFromFixedRectangle(
void)
const;
337 int rectangleIndex(
void)
const;
342 void generateFixedRectangleConstraints(
349 int m_rectangle_index;
362 virtual void printCreationCode(FILE *fp)
const;
363 virtual void outputToSVG(FILE *fp)
const;
365 std::valarray<unsigned> hullRIDs;
366 std::valarray<unsigned char> hullCorners;
371 #endif // COLA_CLUSTER_H cola::Box margin(void) const
Returns the margin box for this cluster.
Definition: cluster.cpp:265
A variable is comprised of an ideal position, final position and a weight.
Definition: variable.h:44
void addChildCluster(Cluster *cluster)
Mark a cluster as being a sub-cluster of this cluster.
Definition: cluster.cpp:708
RectangularCluster()
A rectangular cluster of variable size that contains its children.
Definition: cluster.cpp:212
void setMargin(double margin)
Sets the margin size for this cluster.
Definition: cluster.cpp:259
cola::Box padding(void) const
Returns the padding box for this cluster.
Definition: cluster.cpp:283
A box consisting of four edge values for representing padding or margins for rectangles.
Definition: box.h:37
std::vector< Variable * > Variables
A vector of pointers to Variable objects.
Definition: constraint.h:38
Defines a rectangular cluster, either variable-sized with floating sides or a fixed size based on a p...
Definition: cluster.h:218
std::vector< Rectangle * > Rectangles
A vector of pointers to Rectangle objects.
Definition: rectangle.h:246
Holds the cluster hierarchy specification for a diagram.
Definition: cluster.h:172
void setAllowsMultipleParents(const bool value)
Definition: cluster.cpp:623
bool allowsMultipleParents(void) const
Definition: cluster.cpp:618
virtual void addChildNode(unsigned index)
Mark a rectangle as being a child of this cluster.
Definition: cluster.cpp:448
A rectangle represents a fixed-size shape in the diagram that may be moved to prevent overlaps and sa...
Definition: rectangle.h:78
A cluster defines a hierarchical partitioning over the nodes which should be kept disjoint by the lay...
Definition: cluster.h:50
libcola: Force-directed network layout subject to separation constraints library. ...
Definition: box.cpp:25
Dim
Indicates the x- or y-dimension.
Definition: rectangle.h:41
Implements a constrained force-directed layout algorithm.
Definition: cola.h:622
Defines a cluster that will be treated as a convex boundary around the child nodes and clusters...
Definition: cluster.h:358
void setPadding(double padding)
Sets the padding size for this cluster.
Definition: cluster.cpp:277
std::vector< CompoundConstraint * > CompoundConstraints
A vector of pointers to CompoundConstraint objects.
Definition: compound_constraints.h:259
virtual void addChildNode(unsigned index)
Mark a rectangle as being a child of this cluster.
Definition: cluster.cpp:703