Maximum Acyclic Subgraph - Multiple Sequence Alignment
MaximumAcyclicSubgraph
Classes | Public Member Functions | Protected Attributes | List of all members
GraphRenderer Class Reference

This Class stores Methods which manipulates a window in terms of a MAS Game-Structure. More...

#include <GraphRenderer.h>

Collaboration diagram for GraphRenderer:
Collaboration graph
[legend]

Public Member Functions

 GraphRenderer (sf::RenderWindow &window, Gamemaster &gamemaster, float xoffset)
 
 GraphRenderer ()
 
void render (sf::RenderWindow &window, vector< DrawNode > &Nodes, vector< Node > &nodeList)
 
void eventHandler (const sf::Event event, sf::RenderWindow &window, vector< Node > &nodeList, Gamemaster &gamemaster, const sf::Vector2f &mouse_pos)
 
void display_score (sf::RenderWindow &window, const state &gamestate)
 
void update (float delta)
 
void animation (sf::RenderWindow &window, Gamemaster &gamemaster, vector< Node > &nodeList, Button &menuButton)
 
bool getAnimate ()
 
void updateBoundaries (const vector< DrawNode > &Nodes)
 

Protected Attributes

std::vector< FuncArrowShapeconsistentEdges
 vector of FuncArrowShapes which represent consistent edges
 
std::vector< FuncArrowShapeselectedEdges
 vector of FuncArrowShapes which represent selected edges
 
std::vector< ArrowShaperowArrows
 vector of ArrowShapes which get drawed only in a row
 
std::vector< std::vector< sf::RectangleShape > > rects
 vector of vector of rectangles where a rectangle represent a node (with analogue indices)
 
std::vector< TextProps > txt
 vector of textproperties to draw Node strings
 
sf::Vector2i hoverPosition
 a index vector for the actual hovered Node
 
sf::Vector2i clickPosition
 a index vector for the actual clicked Node
 
sf::Color colorOfClickedNode
 the color of the Node rectangle, which is in the position of the clickPosition
 
unsigned maxNodesPerRow
 an upper bound for the row lengths
 
unsigned maxSequences
 an upper boudn for the column lengths
 
int sizeConstant
 a constant which defines the scale of the visuals
 
float offset
 a constant which make a offset on the upper horizontal
 
float moveConstant
 a (upper bound) constant which is used to scroll in terms of computer speed
 
vector< float > boundary
 a vector which save the maximum amount of nodes in each direction
 
vector< float > direction
 a vector of 2 floats which saves the scrolled way of the view
 

Detailed Description

This Class stores Methods which manipulates a window in terms of a MAS Game-Structure.

This Class Stores different functionalitys: The shape and text data which visualize the Graph via the window and a seperate Draw function, the functions which give the Graph functionality and the functions which implement general functionalitys.

an explanation: The Class will get initialized with vectors $\texttt{nodeList, edgeList}$ which have the data of all nodes and edges we're looking for, $\texttt{sizeConstant}$ which is a constant, that is used to scale the visuals in terms of it (see next point) and $\texttt{window}$ what is a reference to the window u want to manipulate.

$\texttt{sizeConstant}\textrm{:}$
We got in the window rectangles and arrows between them. In coordinates would hold:
$\textrm{For the Rectangle }R_{i,j}\textrm{ and a sizeConstant }s\textrm{ ,where }i\textrm{ and }j\textrm{ are the indices of the nodes, holds that length}(R_{i,j})=s, \textrm{width}(R_{i,j})=\frac{1}{2}\cdot s \textrm{ and upperleftpoint}(R_{i,j})= (s\cdot(0,2 + 1,8\cdot j),s\cdot(0,2 + 1,5\cdot i))$

Constructor & Destructor Documentation

GraphRenderer::GraphRenderer ( sf::RenderWindow &  window,
Gamemaster gamemaster,
float  xoffset 
)

a function for the animation

Parameters
windowis the current RenderWindow
gamemastercontains the current coordinates of all nodes
nodeListcontains all nodes
menuButtonis the button to return to the menu The Complete Constructor, which initialize the visuals in the referenced window.
windowa renderWindow what gets the drawed shapes and texts
nodeLista vector of Nodes we use for the game (shape inits)
edgeLista vector of Edges we use for the game (state inits)
GraphRenderer::GraphRenderer ( )

The standard constructor, which do nothing.

Member Function Documentation

void GraphRenderer::animation ( sf::RenderWindow &  window,
Gamemaster gamemaster,
vector< Node > &  nodeList,
Button menuButton 
)

a function which initialize the shapes and texts in terms of the NodeList. this is only called in the constructor.

Parameters
nodeLista vector of Nodes which we want to draw as rectangles with text
void GraphRenderer::display_score ( sf::RenderWindow &  window,
const state gamestate 
)

a function which display the current score of the game

Parameters
windowa renderWindow what gets the new score
gamestateis the current state of the game
void GraphRenderer::eventHandler ( const sf::Event  event,
sf::RenderWindow &  window,
vector< Node > &  nodeList,
Gamemaster gamemaster,
const sf::Vector2f &  mouse_pos 
)

a function which handles events that are given by argument and make adjustments in the argument window

Parameters
windowa renderWindow which is needed to get informations (i.e. mousepos)
eventa Event which will describe the event that will happen
nodeLista vector of Nodes which is needed for a few methods
mouse_posthe current mouse position
bool GraphRenderer::getAnimate ( )
Returns
animate
void GraphRenderer::render ( sf::RenderWindow &  window,
vector< DrawNode > &  Nodes,
vector< Node > &  nodeList 
)

a function which draw the shapes of the class in the argument window

Parameters
windowa renderWindow what gets the drawed shapes and texts
void GraphRenderer::update ( float  delta)

a function which set an upper bound for the scroll speed via the arrow buttons.

Parameters
deltaa float which gets the upper bound

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