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

Plot of a set of membership functions. More...

#include <plot_fs.hpp>

+ Inheritance diagram for slifis_plot::PLOT_FS:
+ Collaboration diagram for slifis_plot::PLOT_FS:

List of all members.

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

Detailed Description

Plot of a set of membership functions.


Constructor & Destructor Documentation

slifis_plot::PLOT_FS::PLOT_FS ( const slifis::FUZZY_ROOT _fs,
int  w = 400,
int  h = 300 
)

References __IN__, and __OUT__.

slifis_plot::PLOT_FS::PLOT_FS ( const PLOT_FS ) [private]

Member Function Documentation

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().

Assigns set s to plot.

References _p_fs.

Referenced by main().

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:

  1. the associated window name, if any, or
  2. the caption of the plot, if any, or
  3. the name of the set of functions.

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]
void slifis_plot::PLOT_FS::P_DrawPlot ( ) [private, virtual]

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().


Member Data Documentation

const pointer on the drawn set of functions.

Referenced by AssignSet(), DrawValue(), GetPlotName(), P_ComputeScale(), P_DrawPlot(), and SelectMf().

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().

Referenced by P_DrawPlot(), and P_InitColorSet().

bool slifis_plot::PLOT_FS::s_ColorSetDone = false [static, private]

Referenced by P_InitColorSet().