Adaptagrams
|
The Edge class represents edges in a graph. More...
#include <graphs.h>
Public Member Functions | |
Edge & | operator= (const dialect::Edge &)=default |
Copy-assignment operator. | |
~Edge (void)=default | |
Destructor. | |
id_type | id (void) const |
Access the unique ID of this instance. More... | |
Node_SP | getOtherEnd (const dialect::Node &end1) const |
Get the opposite endpt, from a given one. More... | |
Node_SP | getSourceEnd (void) const |
Get read-only access to the Node at the source end of this Edge. | |
Node_SP | getTargetEnd (void) const |
Get read-only access to the Node at the target end of this Edge. | |
std::pair< id_type, id_type > | getEndIds (void) const |
Get a pair {srcID, tgtID} giving the IDs of the source and target Nodes. | |
void | setGraph (Graph &graph) |
Tell the Edge which Graph it belongs to. More... | |
void | sever (void) |
"Sever" this Edge, i.e. remove it from the Nodes to which it is attached. | |
BoundingBox | getBoundingBox (void) const |
Get the bounding box for the edge, including its end points and route points. | |
void | addRoutePoint (double x, double y) |
Add a point to the route. | |
void | setRoute (std::vector< Avoid::Point > route) |
Set (overwriting) the entire route. | |
std::vector< Avoid::Point > | getRoute (void) const |
Get a copy of the Edge's route member. May be empty. More... | |
std::vector< Avoid::Point > | getRoutePoints (void) const |
Get route points. More... | |
std::string | writeRouteTglf (void) const |
Write TGLF to represent the route for this Edge. More... | |
std::pair< Avoid::ConnEnd, Avoid::ConnEnd > | makeLibavoidConnEnds (Avoid::ConnDirFlags srcDirs=Avoid::ConnDirAll, Avoid::ConnDirFlags tgtDirs=Avoid::ConnDirAll) |
Build and return a pair of libavoid ConnEnds to represent the endpoints of this Edge. | |
void | setBendNodes (Nodes bends) |
Set the bend nodes. These should be Nodes representing the bend points in the Edge's route. | |
void | addBendNode (Node_SP bn) |
Add a single bend node. | |
Nodes | getBendNodes (void) |
Access the Edge's bend nodes. | |
bool | hasBendNodes (void) |
Check whether this Edge has any bend nodes. | |
void | rotate90cw (void) |
Rotate the connector route 90 degrees clockwise. | |
void | rotate90acw (void) |
Rotate the connector route 90 degrees anticlockwise. | |
void | rotate180 (void) |
Rotate the connector route 180 degrees. | |
void | translate (double dx, double dy) |
Translate the connector route by a given amount in each dimension. More... | |
void | clearRouteAndBends (void) |
Clear the connector route and drop all bend nodes. | |
void | buildRouteFromBends (void) |
Build a connector route based on the bend nodes. | |
std::string | writeSvg (void) const |
Write SVG to represent this Edge. More... | |
std::string | writePolylineConnectorData (void) const |
Write the data for a polyline SVG path for this Edge's connector route. | |
std::string | writeRoundedOrthoConnectorData (void) const |
Write the data for an orthogonal SVG path for this Edge's connector route, using rounded bends. | |
Static Public Member Functions | |
static Edge_SP | allocate (const Node_SP &src, const Node_SP &tgt) |
Factory function. More... | |
The Edge class represents edges in a graph.
|
static |
Factory function.
We make all constructors private and offer a factory function instead, in order to ensure that instances are allocated on the heap, and always come with a shared ptr control block.
Referenced by dialect::Graph::addEdge(), dialect::Graph::cloneNode(), and dialect::Chain::takeShapeBasedConfiguration().
Node_SP Edge::getOtherEnd | ( | const dialect::Node & | end1 | ) | const |
Get the opposite endpt, from a given one.
References dialect::Node::id().
Referenced by dialect::Node::removeEdge().
|
inline |
Get a copy of the Edge's route member. May be empty.
vector< Point > Edge::getRoutePoints | ( | void | ) | const |
Get route points.
Referenced by writePolylineConnectorData(), writeRoundedOrthoConnectorData(), and writeSvg().
|
inline |
Access the unique ID of this instance.
Referenced by dialect::Node::removeEdge(), and dialect::Graph::severEdge().
|
inline |
void Edge::translate | ( | double | dx, |
double | dy | ||
) |
Translate the connector route by a given amount in each dimension.
[in] | dx | The amount by which to translate in the x-dimension. |
[in] | dy | The amount by which to translate in the y-dimension. |
string Edge::writeRouteTglf | ( | void | ) | const |
Write TGLF to represent the route for this Edge.
string Edge::writeSvg | ( | void | ) | const |
Write SVG to represent this Edge.
References getRoutePoints(), writePolylineConnectorData(), and writeRoundedOrthoConnectorData().