Adaptagrams
|
#include <treeplacement.h>
Inherits enable_shared_from_this< TreePlacement >.
Public Member Functions | |
CompassDir | getPlacementDir (void) const |
Get the placement direction. | |
CardinalDir | getGrowthDir (void) const |
Get the growth direction. | |
bool | isExternal (void) const |
Check whether the placement is into the external face. | |
id_type | id (void) const |
Get the unique ID of this instance. | |
size_t | getNumPotentialNbrs (void) |
Check the number of "potential neighbours" of this tree, if placed according to this placement. This is equal to the number of other root nodes on the relevant Sides to which the root node of this placement belongs. | |
double | estimateCost (void) |
Estimate the cost of this placement. | |
Node_SP | getRootNode (void) const |
Get the Node at which the Tree would be rooted: | |
Face & | getFace (void) |
Access the Face to which this placement belongs. | |
void | insertTreeNode (double padding=0) |
Insert a node representing the Tree into the Face to which this placement belongs. More... | |
std::string | toString (void) const |
Get a string representation. | |
Node_SP | buildTreeBox (double padding=0) const |
Determine the size of the tree minus the root node, and the position relative to the root node. More... | |
void | recordBoxNode (Node_SP &boxNode) |
Record the Node representing the box for the Tree. | |
bool | hasBoxNode (void) |
Check whether this TreePlacement has a box node yet. | |
Node_SP | getBoxNode (void) |
Get the box node. | |
ProjSeq_SP | buildBestProjSeq (double padding=0, bool doCostlierDimensionFirst=false, ExpansionEstimateMethod expansionMethod=ExpansionEstimateMethod::CONSTRAINTS) |
Build the best projection sequence for this tree placement. More... | |
bool | somePointOppositeSegment (LineSegment &seg, Avoid::Point &pt, double padding=-1, bool openInterval=false) |
Compute some point belonging to the tree box and lying opposite a given line segment. More... | |
void | applyGeometryToTree (void) |
Rotate, flip, and translate the tree as necessary to match this placement. | |
void | insertTreeIntoGraph (Graph &G, NodesById &treeNodes, NodesById &bufferNodes, EdgesById &treeEdges) |
Insert the tree into a given Graph. More... | |
size_t | size (void) const |
Check the size (i.e. number of nodes in) the Tree. | |
void | setRootAligns (vpsc::Dim dim, std::set< id_type > &idSet) |
Tell the TreePlacement which Nodes are aligned with its root node in a given dimension. More... | |
bool | rootIsAlignedWith (vpsc::Dim dim, id_type id) |
Check whether the root node is aligned with a given node, in a given dimension. More... | |
A TreePlacement represents a way of placing a tree into the faces of a 4-planar, orthogonal layout.
|
inline |
Build the best projection sequence for this tree placement.
[in] | padding | Optional padding for the new tree box. |
[in] | doCostlierDimensionFirst | Set true to do the more expensive dimension first, in hopes that this will obviate expansion in the other dimension altogether. |
[in] | estimateMethod | See defn of ExpansionEstimateMethod enum class. |
Node_SP TreePlacement::buildTreeBox | ( | double | padding = 0 | ) | const |
Determine the size of the tree minus the root node, and the position relative to the root node.
[in] | padding | Optionally, you may request padding be added to the /outside/ sides of the box, i.e. all those except the side facing the root node. For example, for a north-growing tree, the padding will be added only to the north, east, and west sides. Recommended value for padding is one quarter of the Graph's ideal edge length (iel/4.0). |
References dialect::Node::allocate(), Avoid::Point::x, and Avoid::Point::y.
Referenced by applyGeometryToTree(), and somePointOppositeSegment().
void TreePlacement::insertTreeIntoGraph | ( | Graph & | G, |
NodesById & | treeNodes, | ||
NodesById & | bufferNodes, | ||
EdgesById & | treeEdges | ||
) |
Insert the tree into a given Graph.
[out] | G | The Graph into which the tree is to be inserted. |
[out] | treeNodes | A place to record the tree nodes that are constructred. |
[out] | bufferNodes | A place to record the buffer nodes that are constructred. |
[out] | treeEdges | A place to record the tree edges that are added. |
References dialect::Graph::hasNode(), and dialect::Graph::severAndRemoveNode().
|
inline |
Insert a node representing the Tree into the Face to which this placement belongs.
[in] | padding | Optional padding to be added to the tree box. |
References dialect::Face::insertTreeNode().
bool TreePlacement::rootIsAlignedWith | ( | vpsc::Dim | dim, |
id_type | id | ||
) |
Check whether the root node is aligned with a given node, in a given dimension.
[in] | dim | The dimension of interest. |
[in] | id | The ID of the node in question. |
|
inline |
Tell the TreePlacement which Nodes are aligned with its root node in a given dimension.
[in] | dim | The alignment dimension. |
[in] | idSet | The set of IDs of nodes that are aligned in this dimension with the root node. |
bool TreePlacement::somePointOppositeSegment | ( | LineSegment & | seg, |
Avoid::Point & | pt, | ||
double | padding = -1 , |
||
bool | openInterval = false |
||
) |
Compute some point belonging to the tree box and lying opposite a given line segment.
[in] | seg | The LineSegment in question. |
[out] | pt | The point whose coordinates are to be set. |
[in] | padding | Padding for the tree box. |
[in] | openInterval | Set true if you want to use the open interval of the line segment instead of closed (the default). |
References buildTreeBox(), dialect::Face::getGraph(), Avoid::Point::x, and Avoid::Point::y.