Adaptagrams
cola_topology_addon.h
1 /*
2  * vim: ts=4 sw=4 et tw=0 wm=0
3  *
4  * libtopology - Classes used in generating and managing topology constraints.
5  *
6  * Copyright (C) 2012 Monash University
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  * See the file LICENSE.LGPL distributed with the library.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17  *
18  * Author: Michael Wybrow
19 */
20 
21 #ifndef LAYOUT_TOPOLOGY_CONNECTOR_H
22 #define LAYOUT_TOPOLOGY_CONNECTOR_H
23 
24 #include <vector>
25 
26 #include "libcola/cola.h"
27 #include "libtopology/topology_graph.h"
28 
34 namespace topology {
35 
36 
45 {
46  public:
58 
76 
84  void writeSVGFile(std::string filename = std::string());
85 
86  cola::TopologyAddonInterface *clone(void) const;
87 
88  void freeAssociatedObjects(void);
89  void handleResizes(const cola::Resizes& resizeList, unsigned n,
90  std::valarray<double>& X, std::valarray<double>& Y,
92  vpsc::Rectangles& boundingBoxes,
93  cola::RootCluster* clusterHierarchy);
94  void computePathLengths(unsigned short** G);
95  double computeStress(void) const;
96  bool useTopologySolver(void) const;
97  void makeFeasible(bool generateNonOverlapConstraints,
98  vpsc::Rectangles& boundingBoxes,
99  cola::RootCluster* clusterHierarchy);
100  void moveTo(const vpsc::Dim dim, vpsc::Variables& vs,
101  vpsc::Constraints& cs, std::valarray<double> &coords,
102  cola::RootCluster* clusterHierarchy);
103  double applyForcesAndConstraints(cola::ConstrainedFDLayout *layout,
104  const vpsc::Dim dim, std::valarray<double>& g,
106  std::valarray<double> &coords,
107  cola::DesiredPositionsInDim& des, double oldStress);
108 
111 
114 
115  vpsc::Rectangle *debugSVGViewBox;
116 };
117 
118 }
119 #endif
libtopology: Extensions for topology preservation for libcola and libavoid libraries.
Definition: shape.h:41
topology::Edges topologyRoutes
Topology information: edges routes.
Definition: cola_topology_addon.h:113
This class can be passed to libcola to replace some functionality to provide topology preserving layo...
Definition: cola_topology_addon.h:44
std::vector< Variable * > Variables
A vector of pointers to Variable objects.
Definition: constraint.h:38
Interface for writing COLA addons to handle topology preserving layout.
Definition: cola.h:531
std::vector< Constraint * > Constraints
A vector of pointers to Constraint objects.
Definition: constraint.h:125
topology::Nodes topologyNodes
Topology information: node positions and sizes.
Definition: cola_topology_addon.h:110
std::vector< Rectangle * > Rectangles
A vector of pointers to Rectangle objects.
Definition: rectangle.h:246
std::vector< cola::Resize > Resizes
A vector of Resize objects.
Definition: cola.h:135
Holds the cluster hierarchy specification for a diagram.
Definition: cluster.h:172
std::vector< Node * > Nodes
A vector of pointers to Node objects.
Definition: topology_graph.h:82
A rectangle represents a fixed-size shape in the diagram that may be moved to prevent overlaps and sa...
Definition: rectangle.h:78
std::vector< Edge * > Edges
A vector of pointers to Edge objects.
Definition: topology_graph.h:533
Dim
Indicates the x- or y-dimension.
Definition: rectangle.h:41
Implements a constrained force-directed layout algorithm.
Definition: cola.h:622
void writeSVGFile(std::string filename=std::string())
Writes an SVG file displaying the current topology of the nodes and edges.
Definition: cola_topology_addon.cpp:131
std::vector< CompoundConstraint * > CompoundConstraints
A vector of pointers to CompoundConstraint objects.
Definition: compound_constraints.h:259
ColaTopologyAddon()
Constructs an empty ColaTopologyAddon instance for collecting topology information.
Definition: cola_topology_addon.cpp:35