PEEL Shopping
Open source ecommerce : PEEL Shopping
Public Member Functions | Protected Member Functions | Protected Attributes
Datamatrix Class Reference

Class to create DataMatrix ECC 200 barcode arrays for TCPDF class. More...

Public Member Functions

 __construct ($code)
 This is the class constructor. More...
 
 getBarcodeArray ()
 Returns a barcode array which is readable by TCPDF. More...
 

Protected Member Functions

 getGFProduct ($a, $b, $log, $alog, $gf)
 Product of two numbers in a Power-of-Two Galois Field. More...
 
 getErrorCorrection ($wd, $nb, $nd, $nc, $gf=256, $pp=301)
 Add error correction codewords to data codewords array (ANNEX E). More...
 
 get253StateCodeword ($cwpad, $cwpos)
 Return the 253-state codeword. More...
 
 get255StateCodeword ($cwpad, $cwpos)
 Return the 255-state codeword. More...
 
 isCharMode ($chr, $mode)
 Returns true if the char belongs to the selected mode. More...
 
 lookAheadTest ($data, $pos, $mode)
 The look-ahead test scans the data to be encoded to find the best mode (Annex P - steps from J to S). More...
 
 getSwitchEncodingCodeword ($mode)
 Get the switching codeword to a new encoding mode (latch codeword) More...
 
 getMaxDataCodewords ($numcw)
 Choose the minimum matrix size and return the max number of data codewords. More...
 
 getHighLevelEncoding ($data)
 Get high level encoding using the minimum symbol data characters for ECC 200. More...
 
 placeModule ($marr, $nrow, $ncol, $row, $col, $chr, $bit)
 Places "chr+bit" with appropriate wrapping within array[]. More...
 
 placeUtah ($marr, $nrow, $ncol, $row, $col, $chr)
 Places the 8 bits of a utah-shaped symbol character. More...
 
 placeCornerA ($marr, $nrow, $ncol, $chr)
 Places the 8 bits of the first special corner case. More...
 
 placeCornerB ($marr, $nrow, $ncol, $chr)
 Places the 8 bits of the second special corner case. More...
 
 placeCornerC ($marr, $nrow, $ncol, $chr)
 Places the 8 bits of the third special corner case. More...
 
 placeCornerD ($marr, $nrow, $ncol, $chr)
 Places the 8 bits of the fourth special corner case. More...
 
 getPlacementMap ($nrow, $ncol)
 Build a placement map. More...
 

Protected Attributes

 $barcode_array = array()
 Barcode array to be returned which is readable by TCPDF. More...
 
 $last_enc = ENC_ASCII
 Store last used encoding for data codewords. More...
 
 $symbattr
 Table of Data Matrix ECC 200 Symbol Attributes: More...
 
 $chset_id = array(ENC_C40 => 'C40', ENC_TXT => 'TXT', ENC_X12 =>'X12')
 Map encodation modes whit character sets. More...
 
 $chset
 Basic set of characters for each encodation mode. More...
 

Detailed Description

Class to create DataMatrix ECC 200 barcode arrays for TCPDF class.

DataMatrix (ISO/IEC 16022:2006) is a 2-dimensional bar code.

Definition at line 110 of file datamatrix.php.

Constructor & Destructor Documentation

__construct (   $code)

This is the class constructor.

Creates a datamatrix object

Parameters
$code(string) Code to represent using Datamatrix.

Definition at line 235 of file datamatrix.php.

Member Function Documentation

get253StateCodeword (   $cwpad,
  $cwpos 
)
protected

Return the 253-state codeword.

Parameters
$cwpad(int) Pad codeword.
$cwpos(int) Number of data codewords from the beginning of encoded data.
Returns
pad codeword

Definition at line 444 of file datamatrix.php.

get255StateCodeword (   $cwpad,
  $cwpos 
)
protected

Return the 255-state codeword.

Parameters
$cwpad(int) Pad codeword.
$cwpos(int) Number of data codewords from the beginning of encoded data.
Returns
pad codeword

Definition at line 459 of file datamatrix.php.

getBarcodeArray ( )

Returns a barcode array which is readable by TCPDF.

Returns
array barcode array readable by TCPDF;

Definition at line 350 of file datamatrix.php.

getErrorCorrection (   $wd,
  $nb,
  $nd,
  $nc,
  $gf = 256,
  $pp = 301 
)
protected

Add error correction codewords to data codewords array (ANNEX E).

Parameters
$wd(array) Array of datacodewords.
$nb(int) Number of blocks.
$nd(int) Number of data codewords per block.
$nc(int) Number of correction codewords per block.
$gf(int) numner of fields on log/antilog table (power of 2).
$pp(int) The value of its prime modulus polynomial (301 for ECC200).
Returns
array data codewords + error codewords

Definition at line 382 of file datamatrix.php.

getGFProduct (   $a,
  $b,
  $log,
  $alog,
  $gf 
)
protected

Product of two numbers in a Power-of-Two Galois Field.

Parameters
$a(int) first number to multiply.
$b(int) second number to multiply.
$log(array) Log table.
$alog(array) Anti-Log table.
$gf(array) Number of Factors of the Reed-Solomon polynomial.
Returns
int product

Definition at line 364 of file datamatrix.php.

getHighLevelEncoding (   $data)
protected

Get high level encoding using the minimum symbol data characters for ECC 200.

Parameters
$data(string) data to encode
Returns
array of codewords

Definition at line 702 of file datamatrix.php.

getMaxDataCodewords (   $numcw)
protected

Choose the minimum matrix size and return the max number of data codewords.

Parameters
$numcw(int) Number of current codewords.
Returns
number of data codewords in matrix

Definition at line 687 of file datamatrix.php.

getPlacementMap (   $nrow,
  $ncol 
)
protected

Build a placement map.

(Annex F - ECC 200 symbol character placement)

Parameters
$nrow(int) Number of rows.
$ncol(int) Number of columns.
Returns
array

Definition at line 1089 of file datamatrix.php.

getSwitchEncodingCodeword (   $mode)
protected

Get the switching codeword to a new encoding mode (latch codeword)

Parameters
$mode(int) New encoding mode.
Returns
(int) Switch codeword.

Definition at line 651 of file datamatrix.php.

isCharMode (   $chr,
  $mode 
)
protected

Returns true if the char belongs to the selected mode.

Parameters
$chr(int) Character (byte) to check.
$mode(int) Current encoding mode.
Returns
boolean true if the char is of the selected mode.

Definition at line 474 of file datamatrix.php.

lookAheadTest (   $data,
  $pos,
  $mode 
)
protected

The look-ahead test scans the data to be encoded to find the best mode (Annex P - steps from J to S).

Parameters
$data(string) data to encode
$pos(int) current position
$mode(int) current encoding mode
Returns
int encoding mode

Definition at line 521 of file datamatrix.php.

placeCornerA (   $marr,
  $nrow,
  $ncol,
  $chr 
)
protected

Places the 8 bits of the first special corner case.

(Annex F - ECC 200 symbol character placement)

Parameters
$marr(array) Array of symbols.
$nrow(int) Number of rows.
$ncol(int) Number of columns.
$chr(int) Char byte.
Returns
array

Definition at line 1003 of file datamatrix.php.

placeCornerB (   $marr,
  $nrow,
  $ncol,
  $chr 
)
protected

Places the 8 bits of the second special corner case.

(Annex F - ECC 200 symbol character placement)

Parameters
$marr(array) Array of symbols.
$nrow(int) Number of rows.
$ncol(int) Number of columns.
$chr(int) Char byte.
Returns
array

Definition at line 1025 of file datamatrix.php.

placeCornerC (   $marr,
  $nrow,
  $ncol,
  $chr 
)
protected

Places the 8 bits of the third special corner case.

(Annex F - ECC 200 symbol character placement)

Parameters
$marr(array) Array of symbols.
$nrow(int) Number of rows.
$ncol(int) Number of columns.
$chr(int) Char byte.
Returns
array

Definition at line 1047 of file datamatrix.php.

placeCornerD (   $marr,
  $nrow,
  $ncol,
  $chr 
)
protected

Places the 8 bits of the fourth special corner case.

(Annex F - ECC 200 symbol character placement)

Parameters
$marr(array) Array of symbols.
$nrow(int) Number of rows.
$ncol(int) Number of columns.
$chr(int) Char byte.
Returns
array

Definition at line 1069 of file datamatrix.php.

placeModule (   $marr,
  $nrow,
  $ncol,
  $row,
  $col,
  $chr,
  $bit 
)
protected

Places "chr+bit" with appropriate wrapping within array[].

(Annex F - ECC 200 symbol character placement)

Parameters
$marr(array) Array of symbols.
$nrow(int) Number of rows.
$ncol(int) Number of columns.
$row(int) Row number.
$col(int) Column number.
$chr(int) Char byte.
$bit(int) Bit.
Returns
array

Definition at line 956 of file datamatrix.php.

placeUtah (   $marr,
  $nrow,
  $ncol,
  $row,
  $col,
  $chr 
)
protected

Places the 8 bits of a utah-shaped symbol character.

(Annex F - ECC 200 symbol character placement)

Parameters
$marr(array) Array of symbols.
$nrow(int) Number of rows.
$ncol(int) Number of columns.
$row(int) Row number.
$col(int) Column number.
$chr(int) Char byte.
Returns
array

Definition at line 981 of file datamatrix.php.

Field Documentation

$barcode_array = array()
protected

Barcode array to be returned which is readable by TCPDF.

Definition at line 116 of file datamatrix.php.

$chset
protected

Basic set of characters for each encodation mode.

Definition at line 190 of file datamatrix.php.

$chset_id = array(ENC_C40 => 'C40', ENC_TXT => 'TXT', ENC_X12 =>'X12')
protected

Map encodation modes whit character sets.

Definition at line 184 of file datamatrix.php.

$last_enc = ENC_ASCII
protected

Store last used encoding for data codewords.

Definition at line 122 of file datamatrix.php.

$symbattr
protected

Table of Data Matrix ECC 200 Symbol Attributes:

  • total matrix rows (including finder pattern)
  • total matrix cols (including finder pattern)
  • total matrix rows (without finder pattern)
  • total matrix cols (without finder pattern)
  • region data rows (with finder pattern)
  • region data col (with finder pattern)
  • region data rows (without finder pattern)
  • region data col (without finder pattern)
  • horizontal regions
  • vertical regions
  • regions
  • data codewords
  • error codewords
  • blocks
  • data codewords per block
  • error codewords per block

Definition at line 145 of file datamatrix.php.


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

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:41:43 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.