25 #ifndef DIALECT_TREEPLACEMENT_H 26 #define DIALECT_TREEPLACEMENT_H 33 #include "libvpsc/rectangle.h" 35 #include "libdialect/commontypes.h" 36 #include "libdialect/faces.h" 37 #include "libdialect/graphs.h" 38 #include "libdialect/trees.h" 39 #include "libdialect/ortho.h" 40 #include "libdialect/opts.h" 41 #include "libdialect/constraints.h" 42 #include "libdialect/logging.h" 50 FaceSet_SP
reattachTrees(Graph_SP core, Trees trees, HolaOpts opts, Logger *logger=
nullptr);
61 :
public std::enable_shared_from_this<TreePlacement>
66 CompassDir dp, CardinalDir dg,
bool flip=
false)
87 id_type
id(
void)
const {
return m_ID; }
148 return m_face.
buildBestProjSeq(shared_from_this(), padding, doCostlierDimensionFirst, expansionMethod);
178 size_t size(
void)
const {
return m_tree->size(); }
193 static id_type nextID;
204 CompassDir m_placementDir;
206 CardinalDir m_growthDir;
213 Node_SP m_boxNode =
nullptr;
216 std::map<vpsc::Dim, std::set<id_type>> m_rootAligns;
223 #endif // DIALECT_TREEPLACEMENT_H 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.
Definition: treeplacement.h:183
bool isExternal(void) const
Check whether this is the external face or not.
Definition: faces.h:340
CompassDir getPlacementDir(void) const
Get the placement direction.
Definition: treeplacement.h:78
The Graph class represents graphs consisting of nodes and edges.
Definition: graphs.h:180
TreePlacement_SP chooseBestPlacement(TreePlacements tps, HolaOpts opts)
Choose the best TreePlacement from among a list of alternatives.
Definition: treeplacement.cpp:95
ProjSeq_SP buildBestProjSeq(double padding=0, bool doCostlierDimensionFirst=false, ExpansionEstimateMethod expansionMethod=ExpansionEstimateMethod::CONSTRAINTS)
Build the best projection sequence for this tree placement.
Definition: treeplacement.h:146
bool rootIsAlignedWith(vpsc::Dim dim, id_type id)
Check whether the root node is aligned with a given node, in a given dimension.
Definition: treeplacement.cpp:337
double estimateCost(void)
Estimate the cost of this placement.
Definition: treeplacement.cpp:195
ProjSeq_SP buildBestProjSeq(TreePlacement_SP tp, double padding=0, bool doCostlierDimensionFirst=false, ExpansionEstimateMethod estimateMethod=ExpansionEstimateMethod::CONSTRAINTS)
Build the best projection sequence for a given tree placement.
Definition: faces.cpp:585
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.
Definition: treeplacement.cpp:267
libdialect: A library for computing human-like orthogonal network (DiAlEcT) layouts.
Definition: cola.h:44
std::string toString(void) const
Get a string representation.
Definition: treeplacement.cpp:173
FaceSet_SP reattachTrees(Graph_SP core, Trees trees, HolaOpts opts, Logger *logger=nullptr)
Given a planar orthogonal core, and the corresponding Trees (as resulting from the peeling process)...
Definition: treeplacement.cpp:54
CardinalDir getGrowthDir(void) const
Get the growth direction.
Definition: treeplacement.h:81
Node_SP getBoxNode(void)
Get the box node.
Definition: treeplacement.h:138
size_t getNumPotentialNbrs(void)
Check the number of "potential neighbours" of this tree, if placed according to this placement...
Definition: treeplacement.cpp:184
Definition: treeplacement.h:57
size_t size(void) const
Check the size (i.e. number of nodes in) the Tree.
Definition: treeplacement.h:178
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...
Definition: treeplacement.cpp:201
The Point class defines a point in the plane.
Definition: geomtypes.h:52
ExpansionEstimateMethod
Definition: opts.h:62
bool isExternal(void) const
Check whether the placement is into the external face.
Definition: treeplacement.h:84
Dim
Indicates the x- or y-dimension.
Definition: rectangle.h:41
void recordBoxNode(Node_SP &boxNode)
Record the Node representing the box for the Tree.
Definition: treeplacement.h:132
void insertTreeNode(TreePlacement_SP tp, double padding=0)
To be used after the face has been expanded to make room for the tree. This method adds a large node ...
Definition: faces.cpp:471
id_type id(void) const
Get the unique ID of this instance.
Definition: treeplacement.h:87
Represents a single face of a 4-planar, orthogonal layout.
Definition: faces.h:306
Face & getFace(void)
Access the Face to which this placement belongs.
Definition: treeplacement.h:102
void insertTreeNode(double padding=0)
Insert a node representing the Tree into the Face to which this placement belongs.
Definition: treeplacement.h:108
Node_SP getRootNode(void) const
Get the Node at which the Tree would be rooted:
Definition: treeplacement.h:99
bool hasBoxNode(void)
Check whether this TreePlacement has a box node yet.
Definition: treeplacement.h:135
void insertTreeIntoGraph(Graph &G, NodesById &treeNodes, NodesById &bufferNodes, EdgesById &treeEdges)
Insert the tree into a given Graph.
Definition: treeplacement.cpp:325
void applyGeometryToTree(void)
Rotate, flip, and translate the tree as necessary to match this placement.
Definition: treeplacement.cpp:301