A fuzzy logic C++ library
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
slifis_plot::PLOT_RB_TEXT Class Reference

A plot of a rule base shown as a table: each rule is shown as a line of text, (table-view) More...

#include <plot_rb_text.hpp>

+ Inheritance diagram for slifis_plot::PLOT_RB_TEXT:
+ Collaboration diagram for slifis_plot::PLOT_RB_TEXT:

List of all members.

Public Member Functions

 PLOT_RB_TEXT (const slifis::RULE_BASE &rule_base)
 Constructor (size of plot will be adjusted to necessary)
 ~PLOT_RB_TEXT ()
bool Draw ()
 implementation of virtual method of PLOT
const POSITION_INFOGetPositionInfo (int x, int y)
 Returns information on the position in the plot, given a pixel position (x, y) in plot.
std::string GetPlotName () const
Select functions, take information from \c pos_info
void SelectNewRule ()
 Selection is a new rule.
void SelectRule ()
 Selects a whole row.
void SelectOutput ()
 Selects output corresponding to current row/rule (each row of the plot corresponds to a rule)
void SelectInput ()
void SelectRuleOp ()
void SelectInputValue ()
EN_SELECTION_TYPE GetSelectionType () const
void Unselect ()

Private Member Functions

 PLOT_RB_TEXT (const PLOT_RB_TEXT &)
void p_DrawSelection ()
 Draws the current selection as background color on the plot.
void P_PrintCell (size_t x_idx, size_t y_idx, std::string msg) const
 Prints txt inside cell (row,col)
void p_ComputePlotSize ()
 Computes all the grid attributes, and resizes plot according to these results.

Private Attributes

int _line_h
 height of line
int _selected_row
int _selected_col
EN_SELECTION_TYPE _sel_type
POSITION_INFO _pos_info
 holds information on current mouse position

Static Private Attributes

static GAPI_COLOR s_ColSelectedRow = GAPI_BuildColor( 160,160, 50)

Detailed Description

A plot of a rule base shown as a table: each rule is shown as a line of text, (table-view)

Nb of columns = 1 (idx) + 1 ("if") + (nb of inputs*4) + 1 ("then") + 3 ("output is something") -1 = (nb of inputs*4) + 5

See Handling rules for an example.

Example for a 2 input FIS:

For example:

...
1 | if  | temp  | is | high  | and | pressure | is | ok   | then | output | is | bad
2 | if  | temp  | is | low   | and | pressure | is | high | then | output | is | nice
...

Constructor & Destructor Documentation

Constructor (size of plot will be adjusted to necessary)

References __IN__, __OUT__, _line_h, _sel_type, _selected_col, _selected_row, slifis_plot::NO_SELECTION, and p_ComputePlotSize().

References __IN__, and __OUT__.


Member Function Documentation

bool slifis_plot::PLOT_RB_TEXT::Draw ( ) [virtual]
std::string slifis_plot::PLOT_RB_TEXT::GetPlotName ( ) const [virtual]

Selects output corresponding to current row/rule (each row of the plot corresponds to a rule)

References slifis_plot::POSITION_INFO::_idx_row, _pos_info, _sel_type, _selected_col, _selected_row, slifis::RULE_BASE::GetNbRules(), slifis_plot::PLOT_RB::rb, slifis_plot::SELECT_OUTPUT, and SLIFIS_WARNING_1.

Referenced by Mouse_CB_rb_text().

References _sel_type.

Referenced by Mouse_CB_rb_text().

void slifis_plot::PLOT_RB_TEXT::P_PrintCell ( size_t  x_idx,
size_t  y_idx,
std::string  msg 
) const [private]

Member Data Documentation

height of line

Referenced by p_ComputePlotSize(), and PLOT_RB_TEXT().

holds information on current mouse position

Referenced by GetPositionInfo(), SelectInput(), SelectInputValue(), SelectNewRule(), SelectOutput(), SelectRule(), and SelectRuleOp().

Referenced by p_DrawSelection().