Adaptagrams
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
dialect::GhostNode Class Reference

A GhostNode represents another Node. More...

#include <graphs.h>

Inheritance diagram for dialect::GhostNode:
Inheritance graph
Collaboration diagram for dialect::GhostNode:
Collaboration graph

Public Member Functions

virtual id_type id (void) const
 Return an appropriate ID number. More...
 
id_type trueID (void) const
 Simple way to get the true ID of this GhostNode, even if it is currently set to masquerade as the Node it represents.
 
virtual Nodes getChildren (void) const
 As in the Node class, get the neighbours of this Node that sit as the target end of the connecting Edge. More...
 
void setMasquerade (bool doMasquerade)
 Say whether the GhostNode should masquerade as the original Node.
 
- Public Member Functions inherited from dialect::Node
GhostNode_SP makeGhost (void) const
 Allocate a GhostNode of this Node.
 
dialect::Nodeoperator= (const dialect::Node &)=default
 Copy-assignment operator.
 
virtual ~Node (void)=default
 Destructor.
 
unsigned getDegree (void) const
 Check the degree (number of incident Edges) of the Node. More...
 
void setGraph (Graph &graph)
 Tell the Node which Graph it belongs to. More...
 
GraphgetGraph (void)
 Access the Graph to which the Node belongs.
 
void addEdge (const Edge_SP &edge)
 Add an incident Edge.
 
void removeEdge (const dialect::Edge &edge)
 Remove an incident Edge.
 
const EdgesById & getEdgeLookup (void) const
 Read-only access to this Node's lookup map for Edges by their ID.
 
EdgesById getCopyOfEdgeLookup (void) const
 Get a copy of this Node's lookup map for Edges by their ID.
 
void copyGeometry (const dialect::Node &other)
 Give this Node the same coordinates and dimensions as another.
 
void copyOtherGhostProperties (const dialect::Node &other)
 Besides copying geometry, there may be other properties we wish to copy; in particular, properties that are suitable to be copied by a GhostNode.
 
dimensions getHalfDimensions (void) const
 Get an ordered pair (half-width, half-height) for this Node.
 
dimensions getDimensions (void) const
 Get an ordered pair (width, height) for this Node.
 
BoundingBox getBoundingBox (void) const
 Get the bounding box for this Node.
 
Avoid::Point getBoundaryCompassPt (CompassDir dir) const
 Get the point on the boundary of this Node in a given direction from its centre.
 
void setCentre (double cx, double cy)
 Set the position of the node, by setting its centre coordinates.
 
void translate (double dx, double dy)
 Update the position of the node, by adding to its centre coordinates.
 
void applyPlaneMap (PlaneMap map)
 Apply a mapping from libavoid Points to libavoid Points, to this Node's centre.
 
Avoid::Point getCentre (void) const
 Get the centre coordinates of the node.
 
void setExternalId (unsigned id)
 Set an externally-determined ID. (This is useful for TGLF and other interfacing operations.)
 
int getExternalId (void)
 Get the external ID.
 
dialect::Nodes getNeighbours (void) const
 Get the neighbours of this Node.
 
dialect::Nodes getNeighboursCwCyclic (void) const
 Get the neighbours of this Node, listed in clockwise cyclic order (assuming the usual graphics convention of x increasing to the right and y increasing downward).
 
void setDims (double w, double h)
 Set the dimensions of the node.
 
void setBoundingBox (double x, double X, double y, double Y)
 Set the bounding box of the node. This sets both the dimensions and the centre point. More...
 
void addPadding (double dw, double dh)
 Add padding to the node's dimensions. More...
 
void updatePosnFromRect (vpsc::Rectangle *r)
 Update the position of this Node to equal that of the given Rectangle.
 
void updateXCoordFromRect (vpsc::Rectangle *r)
 Update the x-coordinate of this Node to equal that of the given Rectangle.
 
void updateYCoordFromRect (vpsc::Rectangle *r)
 Update the y-coordinate of this Node to equal that of the given Rectangle.
 
Avoid::Polygon makeLibavoidPolygon (void) const
 Build and return a Polygon to represent this Node in libavoid.
 
bool isRoot (void) const
 Check whether this Node has been marked as being a root. This is useful when working with trees, and can be safely ignored when working with other sorts of graphs.
 
void setIsRoot (bool isRoot)
 Say whether this Node is a root. This is useful when working with trees, and can be safely ignored when working with other sorts of graphs.
 
bool liesOppositeSegment (const LineSegment &seg, bool openInterval=false)
 Check whether this Node lies opposite a LineSegment, i.e. whether the sides of the Node lying parallel to the segment intersect its interval. More...
 
std::string writeSvg (bool useExternalId=false) const
 Write SVG to represent this Node. More...
 

Static Public Member Functions

static GhostNode_SP allocate (const Node &node)
 Factory function. More...
 
- Static Public Member Functions inherited from dialect::Node
static Node_SP allocate (void)
 Factory function, to get a shared pointer to a Node allocated on the heap. We make the constructors protected, in order to ensure that Nodes always come with a control block. More...
 
static Node_SP allocate (double w, double h)
 Convenience factory function to set dimensions.
 
static Node_SP allocate (double cx, double dy, double w, double h)
 Convenience factory function to set position and dimensions.
 

Protected Member Functions

 GhostNode (const Node &node)
 We always make a GhostNode as a copy of a plain Node.
 
- Protected Member Functions inherited from dialect::Node
 Node (void)
 Default constructor. More...
 
 Node (double w, double h)
 Construct with dimensions.
 
 Node (double cx, double cy, double w, double h)
 Construct with position and dimensions.
 
 Node (const dialect::Node &)=default
 Copy constructor.
 

Additional Inherited Members

- Protected Attributes inherited from dialect::Node
const id_type m_ID
 An instance's own unique ID:
 
int m_externalID = -1
 
EdgesById m_edges
 Lookup table for incident Edges by Edge's ID:
 

Detailed Description

A GhostNode represents another Node.

When working with techniques that involve decomposing a graph into parts, and then reassembling those parts, it is often useful to have a node in one part represent a node in another part. For example this can be a useful way to manage the nodes where the two parts intersect. The GhostNode class supports this by representing a given Node.

Member Function Documentation

◆ allocate()

static GhostNode_SP dialect::GhostNode::allocate ( const Node node)
inlinestatic

Factory function.

Returns
A shared_ptr to GhostNode (GhostNode_SP).

◆ getChildren()

Nodes GhostNode::getChildren ( void  ) const
virtual

As in the Node class, get the neighbours of this Node that sit as the target end of the connecting Edge.

This method performs the same function as the overriden method in the base Node class. It is only reimplemented in order to ensure that the GhostNode's id() function is used properly.

Reimplemented from dialect::Node.

References id(), and dialect::Node::m_edges.

Here is the call graph for this function:

◆ id()

virtual id_type dialect::GhostNode::id ( void  ) const
inlinevirtual

Return an appropriate ID number.

Whether the GhostNode's actual ID is returned, or that of the Node it represents, depends whether it is set to masquerade.

Reimplemented from dialect::Node.

References dialect::Node::m_ID.

Referenced by getChildren().

Here is the caller graph for this function:

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