FougTools  0.7.0dev-046fb6a
Handy tools for C++, Qt and OpenCascade
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | List of all members
qtcore::GridNumbering Class Reference

Represents standard numbering of grid cells. More...

#include <qttools/core/grid_numbering.h>

Public Types

enum  SweepMode { OneWay, ZigZag }
 

Public Member Functions

 GridNumbering ()
 
 GridNumbering (Qt::Corner corner, Qt::Orientation orientation, SweepMode sweep)
 
Qt::Corner startCorner () const
 
void setStartCorner (Qt::Corner corner)
 
Qt::Orientation orientation () const
 
void setOrientation (Qt::Orientation orientation)
 
SweepMode sweepMode () const
 
void setSweepMode (SweepMode sweepMode)
 

Static Public Member Functions

static QVector< QVector< int > > gridIndexes (const GridNumbering &gridNb, int rowCount, int colCount, int startIndex=0)
 Computes all the indexes of a grid's cells. More...
 

Detailed Description

Represents standard numbering of grid cells.

GridNumbering stores key information about numbering of grid cells :

Member Enumeration Documentation

Enumerator
OneWay 
ZigZag 

Constructor & Destructor Documentation

qtcore::GridNumbering::GridNumbering ( )
qtcore::GridNumbering::GridNumbering ( Qt::Corner  corner,
Qt::Orientation  orientation,
SweepMode  sweep 
)

Member Function Documentation

QVector< QVector< int > > qtcore::GridNumbering::gridIndexes ( const GridNumbering gridNb,
int  rowCount,
int  colCount,
int  startIndex = 0 
)
static

Computes all the indexes of a grid's cells.

The result is an array of grid rows (each row being of the same size).
For example:

  • GridNumbering(Qt::TopRightCorner, Qt::Vertical, GridNumbering::OneWay)
  • rowCount = colCount = 4
  • startIndex = 0

will output:

row[0] == { 12 8 4 0 }
row[1] == { 13 9 5 1 }
row[2] == { 14 10 6 2 }
row[3] == { 15 11 7 3 }
Note
Let N = rowCount and M = colCount , complexity is O(NxM)
Parameters
gridNbHow grid cells have to be numbered
rowCountCount of rows in the grid
colCountCount of columns in the grid
startIndexThe first index to start from (usually 0 or 1)
Qt::Orientation qtcore::GridNumbering::orientation ( ) const
void qtcore::GridNumbering::setOrientation ( Qt::Orientation  orientation)
void qtcore::GridNumbering::setStartCorner ( Qt::Corner  corner)
void qtcore::GridNumbering::setSweepMode ( SweepMode  sweepMode)
Qt::Corner qtcore::GridNumbering::startCorner ( ) const
GridNumbering::SweepMode qtcore::GridNumbering::sweepMode ( ) const

The documentation for this class was generated from the following files: