Bridges-C++  3.4.2
Bridges(C++ API)
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
bridges::datastructure::Element< E > Class Template Reference

#include <Element.h>

Inheritance diagram for bridges::datastructure::Element< E >:
bridges::datastructure::SLelement< E > bridges::datastructure::TreeElement< E > bridges::datastructure::CircSLelement< E > bridges::datastructure::DLelement< E > bridges::datastructure::MLelement< E > bridges::datastructure::BinTreeElement< E > bridges::datastructure::CircDLelement< E > bridges::datastructure::BSTElement< K, E > bridges::datastructure::AVLTreeElement< K, E > bridges::datastructure::KdTreeElement< K, E >

Detailed Description

template<typename E>
class bridges::datastructure::Element< E >

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)
 
Elementoperator= (const Element &e)
 
E & operator= (E const &e)
 
virtual ~Element ()
 
ElementVisualizergetVisualizer ()
 Get the element visualizer object. More...
 
const ElementVisualizergetVisualizer () const
 Get the element visualizer object - constant version. More...
 
LinkVisualizergetLinkVisualizer (const Element *el)
 Returns the LinkVisualizer of element. More...
 
LinkVisualizergetLinkVisualizer (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 *, LinkVisualizerlinks
 

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
 

Constructor & Destructor Documentation

◆ Element() [1/2]

template<typename E >
bridges::datastructure::Element< E >::Element ( const E &  val = E(),
const string &  lab = string() 
)
inlineexplicit

Constructs an element with the provided value and label. The defaults will be used if not provided.

Parameters
valThe data to hold
labThe label to show

◆ Element() [2/2]

template<typename E >
bridges::datastructure::Element< E >::Element ( const Element< E > &  e)
inline

Constructs an element with the provided element as input

Parameters
eelement

◆ ~Element()

template<typename E >
virtual bridges::datastructure::Element< E >::~Element ( )
inlinevirtual

Element destructor

Member Function Documentation

◆ getColor()

template<typename E >
Color bridges::datastructure::Element< E >::getColor ( ) const
inline

Get the current color of the element.

Returns
The color of the element

◆ getElementRepresentation()

template<typename E >
virtual const string bridges::datastructure::Element< E >::getElementRepresentation ( ) const
inlineprotectedvirtual

Gets the JSON string of the element representation.

Returns
The JSON string of this element's properties

Reimplemented in bridges::datastructure::KdTreeElement< K, E >, and bridges::datastructure::BSTElement< K, E >.

◆ getLabel()

template<typename E >
string const& bridges::datastructure::Element< E >::getLabel ( ) const
inline

Gets the label of this element.

Returns
The label of the element

◆ getLinkRepresentation()

template<typename E >
static const string bridges::datastructure::Element< E >::getLinkRepresentation ( const LinkVisualizer lv,
const string &  src,
const string &  dest 
)
inlinestaticprotected

Gets the JSON representation of this link visualizer using the supplied source and destination strings

Parameters
lvThe LinkVisualizer
srcThe source vertex
destThe destination vertex
Returns
The JSON of this link visualizer

◆ getLinkVisualizer() [1/2]

template<typename E >
LinkVisualizer* bridges::datastructure::Element< E >::getLinkVisualizer ( const Element< E > *  el)
inline

Returns the LinkVisualizer of element.

Returns the LinkVisualizer of element "el" or NULL if no link exists

Parameters
elThe terminating element of the link
Returns
The LinkVisualizer

◆ getLinkVisualizer() [2/2]

template<typename E >
LinkVisualizer* bridges::datastructure::Element< E >::getLinkVisualizer ( const Element< E > *  el) const
inline

Returns the LinkVisualizer of element.

Returns the LinkVisualizer of element "el" - Constant version

Parameters
elThe terminating element of the link
Returns
The LinkVisualizer

◆ getLocationX()

template<typename E >
double bridges::datastructure::Element< E >::getLocationX ( ) const
inline

Gets the X coordinate of the location.

Returns
the X coordinate of the element's location attribute

◆ getLocationY()

template<typename E >
double bridges::datastructure::Element< E >::getLocationY ( ) const
inline

Gets the Y coordinate of the location.

Returns
the Y coordinate of the element's location attribute

◆ getOpacity()

template<typename E >
double bridges::datastructure::Element< E >::getOpacity ( )
inline

get opacity of element

Returns
opacity

◆ getShape()

template<typename E >
Shape bridges::datastructure::Element< E >::getShape ( ) const
inline

Returns the shape of the element.

Returns
The shape of the element(one of Shape.CIRCLE, Shape.SQUARE, Shape.DIAMOND, Shape.CROSS, Shape.TRIANGLE, Shape.WYE, Shape.STAR)

◆ getSize()

template<typename E >
double bridges::datastructure::Element< E >::getSize ( ) const
inline

Get element size.

Returns
the size (in pixels) of the element

◆ getValue() [1/2]

template<typename E >
E& bridges::datastructure::Element< E >::getValue ( )
inline

Gets the object held in the generic object E.

Gets the object (generic) held in the element

Returns
The value of the element

◆ getValue() [2/2]

template<typename E >
E const& bridges::datastructure::Element< E >::getValue ( ) const
inline

Gets the object held in the generic object E.

Gets the object (generic) held in the element - const version

Returns
The value of the element

◆ getVisualizer() [1/2]

template<typename E >
ElementVisualizer* bridges::datastructure::Element< E >::getVisualizer ( )
inline

Get the element visualizer object.

Returns
The ElementVisualizer of this element

◆ getVisualizer() [2/2]

template<typename E >
const ElementVisualizer* bridges::datastructure::Element< E >::getVisualizer ( ) const
inline

Get the element visualizer object - constant version.

Returns
The ElementVisualizer of this element

◆ operator=() [1/2]

template<typename E >
Element& bridges::datastructure::Element< E >::operator= ( const Element< E > &  e)
inline

◆ operator=() [2/2]

template<typename E >
E& bridges::datastructure::Element< E >::operator= ( E const &  e)
inline

◆ setColor() [1/2]

template<typename E >
void bridges::datastructure::Element< E >::setColor ( const Color col)
inline

Set the color of the Element.

Parameters
colThe color of the element

◆ setColor() [2/2]

template<typename E >
void bridges::datastructure::Element< E >::setColor ( const string  col)
inline

Set the color by name.

Parameters
colThe color name. Refer to the Color class for supported color names.

◆ setLabel()

template<typename E >
void bridges::datastructure::Element< E >::setLabel ( const string &  lab)
inline

Sets label of this element.

Parameters
labThe label of the element

◆ setLocation()

template<typename E >
void bridges::datastructure::Element< E >::setLocation ( const double &  locX,
const double &  locY 
)
inline

Sets the location attributes of an element.

Parameters
locXX coordinate of the element location
locYY coordinate of the element location

◆ setOpacity()

template<typename E >
void bridges::datastructure::Element< E >::setOpacity ( double  opacity)
inline

Set opacity of element - use the 4th color component.

Parameters
opacity

◆ setShape()

template<typename E >
void bridges::datastructure::Element< E >::setShape ( const Shape shp)
inline

Set the shape of the element.

Parameters
shpis one of Shape.CIRCLE, Shape.SQUARE, Shape.DIAMOND, Shape.CROSS, Shape.TRIANGLE, Shape.WYE, Shape.STAR

◆ setSize()

template<typename E >
void bridges::datastructure::Element< E >::setSize ( const double &  sz)
inline

Sets size of the element.

Parameters
szThe size in pixel weight of the element. Valid Range:[1;50]

◆ setValue()

template<typename E >
void bridges::datastructure::Element< E >::setValue ( const E &  val)
inline

Sets generic object to "val".

Parameters
valThe value of the element to be set

Friends And Related Function Documentation

◆ Array

template<typename E >
template<typename K >
friend class Array
friend

◆ Array1D

template<typename E >
template<typename K >
friend class Array1D
friend

◆ Array2D

template<typename E >
template<typename K >
friend class Array2D
friend

◆ Array3D

template<typename E >
template<typename K >
friend class Array3D
friend

◆ GraphAdjList

template<typename E >
template<typename K , typename E1 , typename E2 >
friend class GraphAdjList
friend

◆ GraphAdjMatrix

template<typename E >
template<typename K , typename E1 , typename E2 >
friend class GraphAdjMatrix
friend

Member Data Documentation

◆ links

template<typename E >
unordered_map<Element*, LinkVisualizer> bridges::datastructure::Element< E >::links
protected

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