A fuzzy logic C++ library
|
Plot of a set of membership functions. More...
#include <plot_fs.hpp>
Public Member Functions | |
PLOT_FS () | |
PLOT_FS (const slifis::FUZZY_ROOT &_fs, int w=400, int h=300) | |
~PLOT_FS () | |
void | DrawValue (slifis::REALVAL x, GAPI_COLOR col=GAPI_BuildColor(0, 0, 255)) |
Draws the value of x and its fuzzified value on all of the membership functions of the set. | |
void | AssignSet (const slifis::FUZZY_ROOT &s) |
Assigns set s to plot. | |
void | SelectMf (int a) |
Used to define a selected membership function. To deselect all, pass -1. | |
int | GetSelectedMf () const |
Return index of selected membership function, -1 if none. | |
std::string | GetPlotName () const |
Returns a string, that can be: | |
Private Member Functions | |
bool | P_ComputeScale () |
Computes the best horizontal scale for the set of mf. | |
void | P_DrawPlot () |
void | P_InitColorSet () |
color set initialisation, if needed. | |
PLOT_FS (const PLOT_FS &) | |
Private Attributes | |
const slifis::FUZZY_ROOT * | _p_fs |
const pointer on the drawn set of functions. | |
int | _SelectedMF |
index of selected MF, -1 if none. | |
Static Private Attributes | |
static const GAPI_COLOR | s_ColorSelected = GAPI_BuildColor( 250, 100, 50 ) |
static const GAPI_COLOR | s_ColorNotSelected = GAPI_BuildColor( 100, 100, 100 ) |
static GAPI_COLOR | s_ColorSet [12] |
static bool | s_ColorSetDone = false |
Plot of a set of membership functions.
References __IN__, __OUT__, _SelectedMF, and P_InitColorSet().
slifis_plot::PLOT_FS::PLOT_FS | ( | const slifis::FUZZY_ROOT & | _fs, |
int | w = 400 , |
||
int | h = 300 |
||
) |
References __IN__, __OUT__, _SelectedMF, and P_InitColorSet().
slifis_plot::PLOT_FS::PLOT_FS | ( | const PLOT_FS & | ) | [private] |
void slifis_plot::PLOT_FS::DrawValue | ( | slifis::REALVAL | x, |
GAPI_COLOR | col = GAPI_BuildColor( 0,0,255) |
||
) | [virtual] |
Draws the value of x and its fuzzified value on all of the membership functions of the set.
Implements slifis_plot::PLOT_FUZZY.
References __IN__, __OUT__, _p_fs, slifis_plot::PLOT_FUZZY::DrawPoint(), slifis::MEMBFUNC::Fuzzify(), slifis::FUZZY_ROOT::GetMf(), slifis::FUZZY_ROOT::GetNbMf(), and slifis::FUZZYVAL::IsZero().
Referenced by Process().
void slifis_plot::PLOT_FS::AssignSet | ( | const slifis::FUZZY_ROOT & | s | ) | [inline] |
void slifis_plot::PLOT_FS::SelectMf | ( | int | a | ) |
Used to define a selected membership function. To deselect all, pass -1.
If no function is selected, they will be drawn with the color set. If there is one, it will be drawn using color PLOT_FS::s_ColorSelected, and the others will have the same color (PLOT_FS::s_ColorNotSelected)
References __IN__, __OUT__, _p_fs, _SelectedMF, slifis::ERR_MFSET_BAD_INDEX, slifis::FUZZY_ROOT::GetNbMf(), and SLIFIS_ERROR_2.
Referenced by main().
int slifis_plot::PLOT_FS::GetSelectedMf | ( | ) | const [inline] |
Return index of selected membership function, -1 if none.
References _SelectedMF.
std::string slifis_plot::PLOT_FS::GetPlotName | ( | ) | const [virtual] |
Returns a string, that can be:
Reimplementation of PLOT::GetPlotName()
Implements slifis_plot::PLOT_FUZZY.
References slifis_plot::PLOT_FUZZY::_caption, slifis_plot::PLOT_FUZZY::_HasCaption, slifis_plot::PLOT::_HasWndName, _p_fs, slifis_plot::PLOT::_wndname, and slifis::FUZZY_ROOT::GetName().
bool slifis_plot::PLOT_FS::P_ComputeScale | ( | ) | [private, virtual] |
Computes the best horizontal scale for the set of mf.
Returns false if unable to find scale (i.e., if all the functions are empty)
Implements slifis_plot::PLOT_FUZZY.
References __IN__, __OUT__, slifis_plot::PLOT_FUZZY::_hscale, _p_fs, slifis_plot::PLOT_FUZZY::_PreviousScaleAvailable, slifis_plot::PLOT_FUZZY::_x_range, slifis::MEMBFUNC::GetFirstPoint(), slifis::MEMBFUNC::GetLastPoint(), slifis::FUZZY_ROOT::GetMf(), slifis::FUZZY_ROOT::GetName(), slifis::FUZZY_ROOT::GetNbMf(), slifis::FPOINT::GetX(), slifis::MEMBFUNC::IsEmpty(), slifis::MEMBFUNC::IsValid(), slifis_plot::PLOT_HSCALE::scale, SLIFIS_WARNING, SLIFIS_WARNING_1, and slifis_plot::PLOT_HSCALE::x0.
void slifis_plot::PLOT_FS::P_DrawPlot | ( | ) | [private, virtual] |
Implements slifis_plot::PLOT_FUZZY.
References __IN__, __OUT__, slifis_plot::PLOT_DATA::_font, slifis_plot::PLOT::_margins, _p_fs, slifis_plot::PLOT::_p_img, _SelectedMF, slifis_plot::PLOT_FUZZY::_x_first, slifis_plot::GAPI_BuildColor(), slifis_plot::GAPI_BuildPoint(), slifis_plot::GAPI_DrawText(), slifis::FUZZY_ROOT::GetMf(), slifis::FUZZY_ROOT::GetName(), slifis::MEMBFUNC::GetName(), slifis::FUZZY_ROOT::GetNbMf(), slifis_plot::PLOT_MARGINS::m_hl, slifis_plot::PLOT_FUZZY::P_DrawMembFunc(), slifis_plot::PLOT::P_GetTextWidth(), slifis_plot::plot_data(), s_ColorNotSelected, s_ColorSelected, s_ColorSet, and SLIFIS_PLOT_NB_COLORS.
void slifis_plot::PLOT_FS::P_InitColorSet | ( | ) | [private] |
color set initialisation, if needed.
References __IN__, __OUT__, FULL, slifis_plot::GAPI_BuildColor(), HALF, s_ColorSet, s_ColorSetDone, and SLIFIS_PLOT_NB_COLORS.
Referenced by PLOT_FS().
const slifis::FUZZY_ROOT* slifis_plot::PLOT_FS::_p_fs [private] |
const pointer on the drawn set of functions.
Referenced by AssignSet(), DrawValue(), GetPlotName(), P_ComputeScale(), P_DrawPlot(), and SelectMf().
int slifis_plot::PLOT_FS::_SelectedMF [private] |
index of selected MF, -1 if none.
Referenced by GetSelectedMf(), P_DrawPlot(), PLOT_FS(), and SelectMf().
const GAPI_COLOR slifis_plot::PLOT_FS::s_ColorSelected = GAPI_BuildColor( 250, 100, 50 ) [static, private] |
Referenced by P_DrawPlot().
const GAPI_COLOR slifis_plot::PLOT_FS::s_ColorNotSelected = GAPI_BuildColor( 100, 100, 100 ) [static, private] |
Referenced by P_DrawPlot().
GAPI_COLOR slifis_plot::PLOT_FS::s_ColorSet [static, private] |
Referenced by P_DrawPlot(), and P_InitColorSet().
bool slifis_plot::PLOT_FS::s_ColorSetDone = false [static, private] |
Referenced by P_InitColorSet().