The main concepts of this project

This whole project will include a designer to create leds figures (AKA patterns) + a player to animate these patterns + a client to send patterns to a distant target board connected to a matrix. The Player will have 2 versions: as client of the Sender for the network version and as pattern reader who can import saved patterns from a file.

Here is my question defined from a top-down approach analysis:

Model from requirements

This software will be used in different ways. You can use it from your PC as from any board that can handle binary executables.

Let's list what is needed:

Requirement list

The previous sections get you introduced to concepts and intentions of the global project. Now let's have an exhaustive features list of what we are waiting from this project.

What we want is to:

  • Design: a pattern or some sequences: computer
  • Play: a recorded pattern or some sequences: anywhere
  • Target: Able to play with any board that can run C++ or Python
  • Network data format: Able to evolve to any protocol, not only TCP. 1
  • Unity: Both the designer and the player have to be in the same environment. No one stands to have different tools in in different places.
  • Openness: The file format exported by the designer GUI can be easily used from another code/software.
  • Flexibility: This is the master word in the project. For example, we want to be able to create patterns and sequences for different model of led matrices
  • Creativity: Like openness, creativity is required to be able to implement any matrix model from the available models.
  • Colors: Nowadays, there are so many displays that with different colors. The designer can handle all colors a matrix can provide.

enter image description here

Division into objects

After generating a set of candidate classes and objects using the classical approach and behavior analysis, the next step was to identify a relationship between these objects and classes.


  • User design a pattern from the design mode
  • User design a sequence from the design mode
  • User run a pattern from the play mode
  • User run a sequence from the play mode
  • Designer write a pattern from the design mode
  • Designer write a sequence from the design mode
  • player read a pattern from the play mode

Events analysis

  • Player reads a sequence from the play mode
  • Player executes a pattern/sequence from the play mode
  • Sender sends a data packet
  • Target board executes player
  • Target board sends commands to the LEDs in the matrix

Here are some classes I have defined but I don't believe the global design is optimum. The main goal is to define according this Activity:

enter image description here

Identifying scenarii

The objects are now identified so the next step in the analysis that come in mind is: How do these objects will interact together? 2 modes have been identified: DESIGN MODE and PLAY MODE. According to the previous list switching from a mode to another lets a user create patterns and test the creations directly by visualizing the animations on the computer screen.

enter image description here

Design docs

I've designed these classes, and I think that it could be improved, mostly the Mathmatrix class with better objects design and C++11. What do you think?

enter image description here

Thus, according to these I've implemented a global class named ProjectMAtrix which instantiates the other classes.

Here it is in a short example:


#include "projectmatrix.h"

ProjectMatrix::ProjectMatrix(const QString M_Name, const quint16 M_Cols, const quint16 M_Rows, const quint32 M_Colors)
    MathMatrix ProjMatrix(M_Name,M_Cols,M_Rows,M_Colors);
    ProjMatrix.SetLine(1,0xFF000001) ;
    ProjMatrix.LineShift( 1);
    ReadMatrix(ProjMatrix );
   // ProjMatrix.TestMatrix();

    SequenceManager Sequencer();

void ProjectMatrix::ReadMatrix(MathMatrix ImgToRead)
    QVector<QRgb> MatrixToRead;
    ImgToRead.GetTableVector( MatrixToRead );

    for (auto it: MatrixToRead )
        qDebug() <<  QString::number( it , 16 ) ;



#include "matrix.h"
#include "configurationmanager.h"
#include "sequencemanager.h"

class ProjectMatrix
    MathMatrix ProjMatrix ;
    ProjectMatrix(const QString M_Name, const quint16 M_Cols, const quint16 M_Rows, const quint32 M_Colors);
    void ReadMatrix(MathMatrix ImgToRead);



#include <QFile>
#include <QImage>

class MathMatrix
    QString Name ;
    quint16 Cols;
    quint16 Rows ;
    quint32 Colors ;
    QImage *WorkMatrix;

    MathMatrix(const QString MName="Matrix Name", const quint16 MCols=8 , const quint16 MRows=8, const quint32 MColors=3);
    QString getName()   { return Name   ;}
    quint16 getCols()   { return Cols   ;}
    quint16 getRows()   { return Rows   ;}
    quint32 getColors() { return Colors ;}    

    void GetTableVector(QVector<QRgb> &MatrixVector );
    bool SetPoint(int Col, int Row, quint32 Color);

#endif // MATRIX_H


#include "matrix.h"

MathMatrix::MathMatrix(const QString MName, const quint16 MCols, const quint16 MRows, const quint32 MColors):
    Name(MName),Cols(MCols),Rows(MRows),Colors( MColors)
     WorkMatrix = new QImage(Cols,Rows,QImage::Format_RGB32);
     Name = MName;
     Cols= MCols ;
     Rows = MRows;
     Colors  = MColors;


bool MathMatrix::SetPoint(int Col, int Row, quint32 Color)
    if (! CheckRanges( Col, Row))
        return false;
    WorkMatrix->setPixel( Col, Row, Color );

    return true ;
void MathMatrix::GetTableVector(  QVector<QRgb> &MatrixVector )
    for ( int row = 0; row < WorkMatrix->height() ; ++row )
        for ( int col = 0; col < WorkMatrix->width(); ++col )
            MatrixVector.push_back( GetPoint(row,col) );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.