Commit 68e31c47 authored by Nathan/Eilisha Shiraini's avatar Nathan/Eilisha Shiraini
Browse files

Added the builder method to add the reference grid

parent c25317b2
......@@ -15,6 +15,7 @@ from . import encoder
from . import reedsolomon
from . import sizes
from . import positions
from . import reference
class AztecBuilder(object):
"""
......@@ -120,7 +121,7 @@ class AztecBuilder(object):
Returns
-------
:py:class:`numpy.ndarray`
The full list of bits that needs to be arranged on the code matrix
The code matrix with the data layed out (and only yhe data)
:py:class:`int`
The number of layers that must be used when arranging the data
:py:class:`bool`
......@@ -139,3 +140,45 @@ class AztecBuilder(object):
for i, bit in enumerate(data):
result[poslist[i]] = bit
return result, layers, compact, wordcount
@staticmethod
def applyRefGrid(data, layers, compact, wordcount):
"""
Add the finder, mode message, orientation pattern and reference grid to the matrix
This method will apply the constant elements, and the mode message,
to the already formed code matrix.
Parameters
----------
data : :py:class:`numpy.ndarray`
The code matrix having the right size. The data does not need to be present.
Will be modified in place.
layers : :py:class:`int`
The number of layers that must be used when arranging the data
compact : :py:class:`bool`
:py:const:`True` if the compact arrangement must be used, :py:const:`False` otherwise
wordcount : :py:class:`tuple` of :py:class:`int`
A 2-tuple of integers, the fisrt elements is the number of data words,
the second is the number of error-correction code words
Returns
-------
:py:class:`numpy.ndarray`
The code matrix with the constant patterns and mode message applied.
Equal by reference to the `data` parameter.
:py:class:`int`
The number of layers that must be used when arranging the data
:py:class:`bool`
:py:const:`True` if the compact arrangement must be used, :py:const:`False` otherwise
:py:class:`tuple` of :py:class:`int`
A 2-tuple of integers, the fisrt elements is the number of data words,
the second is the number of error-correction code words
(passed through from the wordcount parameter)
"""
reference.layoutModeMessage(data, reference.modeMessage(layers, compact, wordcount[0]), layers, compact)
reference.layoutFinder(data, layers, compact)
reference.layoutOrientation(data, layers, compact)
if compact:
reference.layoutRefGrid(data, layers)
return data, layers, compact, wordcount
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment