Adaptagrams
|
The ExpansionManager class. More...
#include <expansion.h>
Public Member Functions | |
ExpansionManager (TreePlacement_SP tp, vpsc::Dim primaryDim=vpsc::HORIZONTAL, double padding=-1) | |
Standard constructor. More... | |
bool | isAxial (vpsc::Dim dim) |
Check whether a given dimension is axial w.r.t. this manager's placement. | |
bool | isTransverse (vpsc::Dim dim) |
Check whether a given dimension is transverse w.r.t. this manager's placement. | |
double | estimateCost (void) const |
Estimate the cost of expanding. | |
std::map< vpsc::Dim, double > | estimateCostByDimension (void) const |
Estimate the cost of expanding in each dimension. This method looks at the length of contained segments, and reports the sum of shortfalls. | |
std::map< vpsc::Dim, double > | estimateCostByDimension2 (void) const |
Estimate the cost of expanding in each dimension. This method computes the initial separation constraints in each dimension and reports the sum of their violations. | |
std::map< CardinalDir, double > | estimateCostByDirection (void) const |
Estimate the cost of expanding in each cardinal direction. | |
ExpansionGoals | getGoals (void) |
Access the goals. | |
ProjSeq_SP | extendProjSeq (ProjSeq_SP ps0) |
Extend a given projection sequence with those projections necessary to achieve all expansion goals of this manager. More... | |
The ExpansionManager class.
An instance of this class is meant to manage the generation of nonoverlap constraints, when making room for a TreePlacement in a Face of a planar orthogonal layout.
The idea is that we choose strategic "goal points" in the face, and compute the line segments from the tree's attachment point to these goal points. We can then use these line segments to determine the nonoverlap constraints by pushing everything on one side of the line to one side, and everything on the other side of the line to the other side.
A TreePlacement has both a "placement direction" dp, and a "growth direction" dg. The former is any compass point, cardinal or ordinal, while the latter must be cardinal. Expansion constraints are said to be "axial" when they operate in the dimension to which dg belongs, and to be "transverse" when they operate in the complementary dimension. For example if dg is NORTH, then SepCo's in the y-dim are axial, while those in the x-dim are transverse.
Similarly, goal points are called axial or transverse according to the type of constraints they generate. If the placement direction dp is cardinal, then there is one transverse goal point, and there are two axial goal poitns. If the placement direction dp is ordinal, there there is one transverse and one axial goal point.
For example, for a north-growing tree that was also placed north, see the figure on the left, below. Rooted at the "o", the three goal points are marked by "a", "b", "c". Goal point "a" is the one transverse goal point, since it will generate expansion constraints operating left and right, i.e. in the x-dimension. Meanwhile points "b" and "c" are the two axial goal points, since they will generate expansion constraints operating up and down, i.e. in the y-dimension.
---a--- a------- | | | | | | | | c---o--b o------b
The figure on the right shows the two goal points for a north-growing tree that was placed north-east. Here there is one transverse goal point ("a"), and one axial ("b").
For each goal point the ExpansionManager constructs an ExpansionGoal object, which in turn uses the ContainedSegment class to generate expansion constraints.
Note: In an earlier version of HOLA (the Python version from 2015), this process was much more complex, potentially considering many more goal points, spanning face concavities. In those caes libavoid was used to find an orthogonal route to the goal point, and the segments of the route were used to select the expansion constraints. That system allowed us to consider all possible ways of expanding a face. The present system is faster and simpler, and is deemed to produce results of equal quality.
ExpansionManager::ExpansionManager | ( | TreePlacement_SP | tp, |
vpsc::Dim | primaryDim = vpsc::HORIZONTAL , |
||
double | padding = -1 |
||
) |
Standard constructor.
[in] | tp | The TreePlacement for which expansion is required. |
[in] | primaryDim | The dimension in which to expand first. |
[in] | padding | Optional padding to add to tree boxes involved in the expansion process. Leave negative for automatic setting equal to one quarter of the ideal edge length of the underlying graph. |
ProjSeq_SP ExpansionManager::extendProjSeq | ( | ProjSeq_SP | ps0 | ) |