SGSolve
SGPlotController Class Reference

Handles the plot settings for SGSolutionHandler. More...

#include <sgplotcontroller.hpp>

Inheritance diagram for SGPlotController:
Collaboration diagram for SGPlotController:

Public Types

enum  PlotMode { Directions, Generation }
 Plot mode for the detailPlot. More...
 
enum  SolutionMode { Progress, Final }
 Solution mode. More...
 

Public Slots

void iterSliderUpdate (int value)
 Slot when the iter and start sliders are moved.
 
void prevAction ()
 Decrements the action.
 
void nextAction ()
 Increments the action.
 
void changeAction (int newAction)
 Sets the action.
 
void changeMode (int newMode)
 Toggles the solution mode.
 

Signals

void solutionChanged ()
 Signal to the state and action models that the solution changed.
 
void actionChanged ()
 Signal to the solutionHandler that the action changed.
 
void stateChanged ()
 Signal to the actionCombo that the state changed.
 
void iterationChanged ()
 Signal to solutionHandler that the iteration changed.
 

Public Member Functions

 SGPlotController (QComboBox *_stateCombo, QComboBox *_actionCombo, QScrollBar *_iterSlider, QScrollBar *_stepSlider, QComboBox *_solutionModeCombo)
 Constructor.
 
int getState () const
 Access method for the current state.
 
int getAction () const
 Access method for the current action.
 
int getActionIndex () const
 Access method for the current action index.
 
int getIteration () const
 Access method for the current iteration number.
 
PlotMode getPlotMode () const
 Access method for the current plot mode.
 
SolutionMode getMode () const
 Access method for the current solution mode.
 
list< SGIteration_MaxMinMax >::const_iterator getCurrentIter () const
 Access method for the current SGIteration_MaxMinMax pointer.
 
int getCurrentIterIndex () const
 Access method for the current SGIteration_MaxMinMax pointer.
 
const SGStepgetCurrentStep () const
 Access method for the current SGStep pointer.
 
int getStepSliderPosition () const
 Returns the position of the stepSlider.
 
bool hasSolution () const
 Returns true if a solution has been loaded.
 
const SGSolution_MaxMinMaxgetSolution () const
 Returns the current solution.
 
void setSolution (SGSolution_MaxMinMax *newSoln)
 Sets the solution.
 
bool setState (int newState)
 Sets the current state.
 
void setPlotMode (PlotMode newMode)
 Sets the plot mode.
 
bool setActionIndex (int newActionIndex)
 Sets the current action index.
 
bool setAction (int newAction)
 Sets the current action.
 
bool setIteration (int newIter)
 Sets the current iteration.
 
void moveForwards ()
 Increments the current iteration.
 
void moveBackwards ()
 Decrements the current iteration.
 
void setCurrentDirection (SGPoint point, int state)
 
void synchronizeSliders ()
 Synchronizes sliders with controls. More...
 
void synchronizeIterSlider ()
 Synchronizes iterSlider.
 
void synchronizeStepSlider ()
 Synchronizes stepSlider.
 

Private Attributes

int state
 Current state.
 
int action
 Current action.
 
int actionIndex
 
int iteration
 The current iteration.
 
SGSolution_MaxMinMaxsoln
 The current solution object.
 
PlotMode plotMode
 The current plot mode.
 
SolutionMode mode
 The current solution mode.
 
list< SGIteration_MaxMinMax >::const_iterator currentIter
 Points to the current SGiteration.
 
list< SGStep >::const_iterator currentStep
 Points to the current step.
 
bool solnLoaded
 Indicates when an SGSolution object has been loaded.
 
QComboBox * stateCombo
 Points to the stateCombo QComboBox selector.
 
QComboBox * actionCombo
 Points to the actionCombo QComboBox selector.
 
QComboBox * solutionModeCombo
 Points to the solutionMode QComboBox selector.
 
QScrollBar * iterSlider
 Points to the iterSlider QScrollBar for selecting the current iteration.
 
QScrollBar * stepSlider
 

Detailed Description

Handles the plot settings for SGSolutionHandler.

This class intermediates between the controllers (iterSlider, stateCombo, actionCombo) and the plotting methods in the SGSSolutionHandler (i.e., plotSolution(...)).

See also viewersolutionsec.

Member Enumeration Documentation

◆ PlotMode

Plot mode for the detailPlot.

Indicates whether to plot all of the test directions (Directions) or just plot the way the current pivot is generated (Generation).

Enumerator
Directions 

Plot the test directions.

Generation 

Plot how the payoffs are generated.

◆ SolutionMode

Solution mode.

Indicates whether or not to plot all of the iterations from a user-defined start point to the current iteration (Progress) or just plot all of the iterations on the last revolution (Final).

Enumerator
Progress 

Plot the progress of the algorithm.

Final 

Plot the last revolution (the true correspondence)

Member Function Documentation

◆ setCurrentDirection()

void SGPlotController::setCurrentDirection ( SGPoint  point,
int  state 
)

Sets the current direction to be the one where the pivot in the given state is closest to point.

◆ synchronizeSliders()

void SGPlotController::synchronizeSliders ( )

Synchronizes sliders with controls.

Sets startIter and currentIter to be equal to the values indicated in the respective sliders.

Member Data Documentation

◆ actionIndex

int SGPlotController::actionIndex
private

Index of the current action within the list of actions in currentIter->actions[state]

◆ stepSlider

QScrollBar* SGPlotController::stepSlider
private

Points to the stepSlider QScrollBar for selecting the start iteration when the solution mode is Progress.


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