A fuzzy logic C++ library
|
Used only a a helper class for PLOT_RB_TEXT, holds pixel mouse position information AND destination image and font. More...
#include <grid.hpp>
Public Member Functions | |
GRID () | |
~GRID () | |
void | SetSize (size_t Nb_Rows, size_t Nb_Cols) |
Sets size of grid (nb of lines and columns). Clears all positions values, and resets width and heigth to default values. | |
size_t | GetNbCols () const |
size_t | GetNbRows () const |
GRID_CELL | GetCell (size_t row, size_t col) const |
Return cell identified by row , col . | |
GRID_CELL | GetRow (size_t row_idx) const |
size_t | GetW () const |
returns width (pixels) of table ONLY, without margins | |
size_t | GetH () const |
returns height (pixels) of table ONLY, without margins | |
void | SetRowHeight (size_t h) |
Assigns a default height to every row. | |
void | SetRowHeight (size_t idx, size_t h) |
void | SetColumnWidth (size_t w) |
Assigns a default width to every column. | |
void | SetColumnWidth (size_t idx, size_t w) |
Set the width of a column idx to value w , or to minimum value. | |
void | tPrint (FILE *f) const |
void | DrawGrid () const |
void | SetImage (GAPI_IMAGE **im, GAPI_FONT *f) |
void | SetMargins (PLOT_MARGINS *) |
Private Member Functions | |
void | P_ComputePos () |
Computes all the positions (pixel values) of the table, from each column width and each row height (these must have been set) | |
void | P_Check (size_t row, size_t col) const |
Private Attributes | |
size_t | _grid_width |
width in pixels of the table, computed by ComputePos() (WIHOUT margins) | |
size_t | _grid_height |
height in pixels of the table, computed by ComputePos() (WIHOUT margins) | |
GAPI_IMAGE ** | pp_im_table |
A pointer on the pointer on image, allocated in PLOT. This pointer is initialised by a call to SetImage(), called by constructor of PLOT_RB. | |
GAPI_FONT * | p_font_table |
A pointer on the font used for drawing text. Initialised in. | |
PLOT_MARGINS * | p_margins |
pointer on margins of the plot (these live in PLOT_RB) | |
std::vector< size_t > | _col_width |
vector of column widths (for PLOT_RB_TEXT, vector size is (nb of inputs*4) + 1 ("if") + 1 ("then") + 3 ("output is something") -1 | |
std::vector< size_t > | _row_height |
height of each row | |
std::vector< size_t > | _pos_h |
vector of first horizontal position of each cell (starting at 0: without margins!) | |
std::vector< size_t > | _pos_v |
vector of first vertical position of each cell | |
GAPI_COLOR | _ColorGrid |
Friends | |
class | GRID_CELL |
Used only a a helper class for PLOT_RB_TEXT, holds pixel mouse position information AND destination image and font.
See related class GRID_CELL
References _ColorGrid, DEF_COLOR_GRID, p_font_table, and pp_im_table.
void slifis_plot::GRID::SetSize | ( | size_t | Nb_Rows, |
size_t | Nb_Cols | ||
) |
Sets size of grid (nb of lines and columns). Clears all positions values, and resets width and heigth to default values.
References __IN__, __OUT__, _col_width, _pos_h, _pos_v, _row_height, GRID_DEF_H, GRID_DEF_W, SetColumnWidth(), and SetRowHeight().
Referenced by slifis_plot::PLOT_RB_2D::Draw(), and slifis_plot::PLOT_RB_TEXT::p_ComputePlotSize().
size_t slifis_plot::GRID::GetNbCols | ( | ) | const [inline] |
References _pos_h.
Referenced by slifis_plot::PLOT_RB_TEXT::Draw(), DrawGrid(), GetH(), slifis_plot::PLOT_RB::GetIndexCoordinates(), slifis_plot::PLOT_RB_TEXT::GetPositionInfo(), GetW(), P_Check(), slifis_plot::PLOT_RB_TEXT::p_ComputePlotSize(), slifis_plot::PLOT_RB_TEXT::p_DrawSelection(), and SetColumnWidth().
size_t slifis_plot::GRID::GetNbRows | ( | ) | const [inline] |
References _pos_v.
Referenced by DrawGrid(), GetH(), slifis_plot::PLOT_RB::GetIndexCoordinates(), GetW(), P_Check(), and SetRowHeight().
GRID_CELL slifis_plot::GRID::GetCell | ( | size_t | row, |
size_t | col | ||
) | const |
Return cell identified by row
, col
.
References __IN__, __OUT__, _col_width, _pos_h, _pos_v, _row_height, slifis_plot::PLOT_MARGINS::m_hl, slifis_plot::PLOT_MARGINS::m_vt, P_Check(), p_margins, slifis_plot::GRID_CELL::SetPos(), and slifis_plot::GRID_CELL::SetSize().
Referenced by slifis_plot::PLOT_RB_2D::Draw(), slifis_plot::PLOT_RB::GetIndexCoordinates(), slifis_plot::PLOT_RB_2D::P_DrawFiringStrength(), slifis_plot::PLOT_RB_2D::P_DrawIndexes(), slifis_plot::PLOT_RB_TEXT::p_DrawSelection(), and slifis_plot::PLOT_RB_TEXT::P_PrintCell().
GRID_CELL slifis_plot::GRID::GetRow | ( | size_t | row_idx | ) | const |
size_t slifis_plot::GRID::GetW | ( | ) | const [inline] |
returns width (pixels) of table ONLY, without margins
References _grid_width, GetNbCols(), and GetNbRows().
Referenced by slifis_plot::PLOT_RB_TEXT::p_ComputePlotSize().
size_t slifis_plot::GRID::GetH | ( | ) | const [inline] |
returns height (pixels) of table ONLY, without margins
References _grid_height, GetNbCols(), and GetNbRows().
Referenced by slifis_plot::PLOT_RB_TEXT::p_ComputePlotSize().
void slifis_plot::GRID::SetRowHeight | ( | size_t | h | ) |
Assigns a default height to every row.
References __IN__, __OUT__, _row_height, GetNbRows(), and P_ComputePos().
Referenced by slifis_plot::PLOT_RB_2D::Draw(), slifis_plot::PLOT_RB_TEXT::p_ComputePlotSize(), and SetSize().
void slifis_plot::GRID::SetRowHeight | ( | size_t | idx, |
size_t | h | ||
) |
References __IN__, __OUT__, _row_height, GetNbRows(), P_ComputePos(), and TABLE_MAX_HEIGHT.
void slifis_plot::GRID::SetColumnWidth | ( | size_t | w | ) |
Assigns a default width to every column.
References __IN__, __OUT__, _col_width, GetNbCols(), and P_ComputePos().
Referenced by slifis_plot::PLOT_RB_2D::Draw(), slifis_plot::PLOT_RB_TEXT::p_ComputePlotSize(), and SetSize().
void slifis_plot::GRID::SetColumnWidth | ( | size_t | idx, |
size_t | w | ||
) |
Set the width of a column idx
to value w
, or to minimum value.
References __IN__, __OUT__, _col_width, GetNbCols(), P_ComputePos(), and TABLE_MAX_WIDTH.
void slifis_plot::GRID::tPrint | ( | FILE * | f | ) | const |
References _col_width, _grid_height, _grid_width, _pos_h, and _pos_v.
void slifis_plot::GRID::DrawGrid | ( | ) | const |
References __IN__, __OUT__, _ColorGrid, _grid_height, _grid_width, _pos_h, _pos_v, slifis_plot::GAPI_BuildPoint(), slifis_plot::GAPI_DrawLine(), GetNbCols(), GetNbRows(), slifis_plot::PLOT_MARGINS::m_hl, slifis_plot::PLOT_MARGINS::m_vt, p_margins, and pp_im_table.
Referenced by slifis_plot::PLOT_RB_2D::Draw(), and slifis_plot::PLOT_RB_TEXT::Draw().
void slifis_plot::GRID::SetImage | ( | GAPI_IMAGE ** | im, |
GAPI_FONT * | f | ||
) |
References p_font_table, and pp_im_table.
Referenced by slifis_plot::PLOT_RB::PLOT_RB().
void slifis_plot::GRID::SetMargins | ( | PLOT_MARGINS * | marg | ) |
References p_margins.
Referenced by slifis_plot::PLOT_RB::PLOT_RB().
void slifis_plot::GRID::P_ComputePos | ( | ) | [private] |
Computes all the positions (pixel values) of the table, from each column width and each row height (these must have been set)
References __IN__, __OUT__, _col_width, _grid_height, _grid_width, _pos_h, _pos_v, and _row_height.
Referenced by SetColumnWidth(), and SetRowHeight().
void slifis_plot::GRID::P_Check | ( | size_t | row, |
size_t | col | ||
) | const [private] |
References GetNbCols(), GetNbRows(), and SLIFIS_ERROR_LOG.
Referenced by GetCell().
friend class GRID_CELL [friend] |
size_t slifis_plot::GRID::_grid_width [private] |
width in pixels of the table, computed by ComputePos() (WIHOUT margins)
Referenced by DrawGrid(), GetRow(), GetW(), P_ComputePos(), and tPrint().
size_t slifis_plot::GRID::_grid_height [private] |
height in pixels of the table, computed by ComputePos() (WIHOUT margins)
Referenced by DrawGrid(), GetH(), P_ComputePos(), and tPrint().
GAPI_IMAGE** slifis_plot::GRID::pp_im_table [private] |
A pointer on the pointer on image, allocated in PLOT. This pointer is initialised by a call to SetImage(), called by constructor of PLOT_RB.
Referenced by DrawGrid(), GRID(), slifis_plot::GRID_CELL::GRID_CELL(), and SetImage().
GAPI_FONT* slifis_plot::GRID::p_font_table [private] |
A pointer on the font used for drawing text. Initialised in.
Referenced by GRID(), slifis_plot::GRID_CELL::GRID_CELL(), and SetImage().
PLOT_MARGINS* slifis_plot::GRID::p_margins [private] |
pointer on margins of the plot (these live in PLOT_RB)
Referenced by DrawGrid(), GetCell(), GetRow(), and SetMargins().
std::vector<size_t> slifis_plot::GRID::_col_width [private] |
vector of column widths (for PLOT_RB_TEXT, vector size is (nb of inputs*4) + 1 ("if") + 1 ("then") + 3 ("output is something") -1
Referenced by GetCell(), P_ComputePos(), SetColumnWidth(), SetSize(), and tPrint().
std::vector<size_t> slifis_plot::GRID::_row_height [private] |
height of each row
Referenced by GetCell(), GetRow(), P_ComputePos(), SetRowHeight(), and SetSize().
std::vector<size_t> slifis_plot::GRID::_pos_h [private] |
vector of first horizontal position of each cell (starting at 0: without margins!)
Referenced by DrawGrid(), GetCell(), GetNbCols(), P_ComputePos(), SetSize(), and tPrint().
std::vector<size_t> slifis_plot::GRID::_pos_v [private] |
vector of first vertical position of each cell
Referenced by DrawGrid(), GetCell(), GetNbRows(), GetRow(), P_ComputePos(), SetSize(), and tPrint().
GAPI_COLOR slifis_plot::GRID::_ColorGrid [private] |
Referenced by DrawGrid(), and GRID().