Bridges-C++
3.4.4
Bridges(C++ API)
|
#include <Element.h>
This is the fundamental building block for all data structures in BRIDGES.
This is the Superclass Element for SLelement, DLelement, MLElement, CircSlElement, CircDlElement, TreeElement, BinTreeElement, BSTElement, AVLTreeElement, and KdTreeElement subclasses.
The label field(string type) is used to label the visualization of the element.
Element holds a LinkVisualizer for each of its links and an ElementVisualizer for itself; these are use for styling the nodes and edges (emanating from the link, if there is a destination element), respectively.
All the tutorials under
https://bridgesuncc.github.io/tutorials/Overview.html
show how to use different types of elements
@param E the application data type @author Kalpathi Subramanian @date 6/11/15, 11/27/16, 7/12/19, 12/28/20
Public Member Functions | |
Element (const E &val=E(), const string &lab=string()) | |
Element (const Element &e) | |
Element & | operator= (const Element &e) |
E & | operator= (E const &e) |
virtual | ~Element () |
ElementVisualizer * | getVisualizer () |
Get the element visualizer object. More... | |
const ElementVisualizer * | getVisualizer () const |
Get the element visualizer object - constant version. More... | |
LinkVisualizer * | getLinkVisualizer (const Element *el) |
Returns the LinkVisualizer of element. More... | |
LinkVisualizer * | getLinkVisualizer (const Element *el) const |
Returns the LinkVisualizer of element. More... | |
string const & | getLabel () const |
Gets the label of this element. More... | |
void | setLabel (const string &lab) |
Sets label of this element. More... | |
E const & | getValue () const |
Gets the object held in the generic object E. More... | |
E & | getValue () |
Gets the object held in the generic object E. More... | |
void | setValue (const E &val) |
Sets generic object to "val". More... | |
void | setSize (const double &sz) |
Sets size of the element. More... | |
double | getSize () const |
Get element size. More... | |
void | setColor (const Color &col) |
Set the color of the Element. More... | |
void | setColor (const string col) |
Set the color by name. More... | |
Color | getColor () const |
Get the current color of the element. More... | |
void | setOpacity (double opacity) |
Set opacity of element - use the 4th color component. More... | |
double | getOpacity () |
void | setShape (const Shape &shp) |
Set the shape of the element. More... | |
Shape | getShape () const |
Returns the shape of the element. More... | |
void | setLocation (const double &locX, const double &locY) |
Sets the location attributes of an element. More... | |
double | getLocationX () const |
Gets the X coordinate of the location. More... | |
double | getLocationY () const |
Gets the Y coordinate of the location. More... | |
Protected Member Functions | |
virtual const string | getElementRepresentation () const |
Gets the JSON string of the element representation. More... | |
Static Protected Member Functions | |
static const string | getLinkRepresentation (const LinkVisualizer &lv, const string &src, const string &dest) |
Protected Attributes | |
unordered_map< Element *, LinkVisualizer > | links |
Friends | |
template<typename K , typename E1 , typename E2 > | |
class | GraphAdjList |
template<typename K , typename E1 , typename E2 > | |
class | GraphAdjMatrix |
template<typename K > | |
class | Array |
template<typename K > | |
class | Array1D |
template<typename K > | |
class | Array2D |
template<typename K > | |
class | Array3D |
|
inlineexplicit |
Constructs an element with the provided value and label. The defaults will be used if not provided.
val | The data to hold |
lab | The label to show |
|
inline |
Constructs an element with the provided element as input
e | element |
|
inlinevirtual |
Element destructor
|
inline |
Get the current color of the element.
|
inlineprotectedvirtual |
Gets the JSON string of the element representation.
Reimplemented in bridges::datastructure::KdTreeElement< K, E >, and bridges::datastructure::BSTElement< K, E >.
|
inline |
Gets the label of this element.
|
inlinestaticprotected |
Gets the JSON representation of this link visualizer using the supplied source and destination strings
lv | The LinkVisualizer |
src | The source vertex |
dest | The destination vertex |
|
inline |
Returns the LinkVisualizer of element.
Returns the LinkVisualizer of element "el" or NULL if no link exists
el | The terminating element of the link |
|
inline |
Returns the LinkVisualizer of element.
Returns the LinkVisualizer of element "el" - Constant version
el | The terminating element of the link |
|
inline |
Gets the X coordinate of the location.
|
inline |
Gets the Y coordinate of the location.
|
inline |
get opacity of element
|
inline |
Returns the shape of the element.
|
inline |
Get element size.
|
inline |
Gets the object held in the generic object E.
Gets the object (generic) held in the element
|
inline |
Gets the object held in the generic object E.
Gets the object (generic) held in the element - const version
|
inline |
Get the element visualizer object.
|
inline |
Get the element visualizer object - constant version.
|
inline |
|
inline |
|
inline |
Set the color of the Element.
col | The color of the element |
|
inline |
Set the color by name.
col | The color name. Refer to the Color class for supported color names. |
|
inline |
Sets label of this element.
lab | The label of the element |
|
inline |
Sets the location attributes of an element.
locX | X coordinate of the element location |
locY | Y coordinate of the element location |
|
inline |
Set opacity of element - use the 4th color component.
opacity |
|
inline |
Set the shape of the element.
shp | is one of Shape.CIRCLE, Shape.SQUARE, Shape.DIAMOND, Shape.CROSS, Shape.TRIANGLE, Shape.WYE, Shape.STAR |
|
inline |
Sets size of the element.
sz | The size in pixel weight of the element. Valid Range:[1;50] |
|
inline |
Sets generic object to "val".
val | The value of the element to be set |
|
friend |
|
friend |
|
protected |