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

Used only a a helper class for PLOT_RB_TEXT, holds pixel mouse position information AND destination image and font. More...

#include <grid.hpp>

+ Collaboration diagram for slifis_plot::GRID:

List of all members.

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_FONTp_font_table
 A pointer on the font used for drawing text. Initialised in.
PLOT_MARGINSp_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

Detailed Description

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


Constructor & Destructor Documentation


Member Function Documentation

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]
size_t slifis_plot::GRID::GetNbRows ( ) const [inline]
GRID_CELL slifis_plot::GRID::GetCell ( size_t  row,
size_t  col 
) const
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)
void slifis_plot::GRID::SetRowHeight ( size_t  idx,
size_t  h 
)

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 p_font_table, and pp_im_table.

Referenced by slifis_plot::PLOT_RB::PLOT_RB().

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


Friends And Related Function Documentation

friend class GRID_CELL [friend]

Member Data Documentation

width in pixels of the table, computed by ComputePos() (WIHOUT margins)

Referenced by DrawGrid(), GetRow(), GetW(), P_ComputePos(), and tPrint().

height in pixels of the table, computed by ComputePos() (WIHOUT margins)

Referenced by DrawGrid(), GetH(), P_ComputePos(), and tPrint().

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

A pointer on the font used for drawing text. Initialised in.

Referenced by GRID(), slifis_plot::GRID_CELL::GRID_CELL(), and SetImage().

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

Referenced by DrawGrid(), and GRID().