Adaptagrams
Public Member Functions | List of all members
dialect::TreePlacement Class Reference

#include <treeplacement.h>

Inherits enable_shared_from_this< TreePlacement >.

Collaboration diagram for dialect::TreePlacement:
Collaboration graph

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:
 
FacegetFace (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...
 

Detailed Description

A TreePlacement represents a way of placing a tree into the faces of a 4-planar, orthogonal layout.

Member Function Documentation

◆ buildBestProjSeq()

ProjSeq_SP dialect::TreePlacement::buildBestProjSeq ( double  padding = 0,
bool  doCostlierDimensionFirst = false,
ExpansionEstimateMethod  expansionMethod = ExpansionEstimateMethod::CONSTRAINTS 
)
inline

Build the best projection sequence for this tree placement.

Parameters
[in]paddingOptional padding for the new tree box.
[in]doCostlierDimensionFirstSet true to do the more expensive dimension first, in hopes that this will obviate expansion in the other dimension altogether.
[in]estimateMethodSee defn of ExpansionEstimateMethod enum class.
Returns
A ProjSeq representing the computed projection sequence.

◆ buildTreeBox()

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.

Parameters
[in]paddingOptionally, 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).
Returns
A Node whose dimensions w x h gives the dimensions of the bounding box of the tree, minus the root node, and whose position (x, y) gives the vector from the centre of the root node to the centre of this box.
Note
The dimensions are in respect of the growth direction of this TreePlacement, and the position vector is in respect of its placement direction and flip bit.

References dialect::Node::allocate(), Avoid::Point::x, and Avoid::Point::y.

Referenced by applyGeometryToTree(), and somePointOppositeSegment().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertTreeIntoGraph()

void TreePlacement::insertTreeIntoGraph ( Graph G,
NodesById &  treeNodes,
NodesById &  bufferNodes,
EdgesById &  treeEdges 
)

Insert the tree into a given Graph.

Parameters
[out]GThe Graph into which the tree is to be inserted.
[out]treeNodesA place to record the tree nodes that are constructred.
[out]bufferNodesA place to record the buffer nodes that are constructred.
[out]treeEdgesA place to record the tree edges that are added.

References dialect::Graph::hasNode(), and dialect::Graph::severAndRemoveNode().

Here is the call graph for this function:

◆ insertTreeNode()

void dialect::TreePlacement::insertTreeNode ( double  padding = 0)
inline

Insert a node representing the Tree into the Face to which this placement belongs.

Parameters
[in]paddingOptional padding to be added to the tree box.
See also
TreePlacement::getTreeBox for interpretation of the padding.

References dialect::Face::insertTreeNode().

Here is the call graph for this function:

◆ rootIsAlignedWith()

bool TreePlacement::rootIsAlignedWith ( vpsc::Dim  dim,
id_type  id 
)

Check whether the root node is aligned with a given node, in a given dimension.

Parameters
[in]dimThe dimension of interest.
[in]idThe ID of the node in question.

◆ setRootAligns()

void dialect::TreePlacement::setRootAligns ( vpsc::Dim  dim,
std::set< id_type > &  idSet 
)
inline

Tell the TreePlacement which Nodes are aligned with its root node in a given dimension.

Parameters
[in]dimThe alignment dimension.
[in]idSetThe set of IDs of nodes that are aligned in this dimension with the root node.

◆ somePointOppositeSegment()

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.

Parameters
[in]segThe LineSegment in question.
[out]ptThe point whose coordinates are to be set.
[in]paddingPadding for the tree box.
[in]openIntervalSet true if you want to use the open interval of the line segment instead of closed (the default).
Returns
boolean saying whether the tree box indeed lies opposite the given line segment.
Note
We compute the interval I of the tree box in the dimension parallel to the segment. Let J be the interval of the segment – open if the openInterval argument is true; closed otherwise. Let K be the intersection of I and J. If K is empty then we return false. Otherwise we pick a value w in K and return a point having w as one of its coordinates and a centre coordinate of the tree box as the other coordinate.

References buildTreeBox(), dialect::Face::getGraph(), Avoid::Point::x, and Avoid::Point::y.

Here is the call graph for this function:

The documentation for this class was generated from the following files: