autocell.cpp 14.5 KB
Newer Older
1
2
3
4
5
#include <autocell.h>
#include <reseau_cellule_etats.h>
#include <autosql.h>
#include <Automate.h>
#include <parametragemodele.h>
Victor Blanchet's avatar
Victor Blanchet committed
6
7
8

#include <QApplication>
#include <QPushButton>
Victor Blanchet's avatar
Victor Blanchet committed
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <QWidget>
#include <QLineEdit>
#include <QLabel>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QComboBox>
#include <QTableWidget>
#include <QTableWidgetItem>
#include <QHeaderView>
#include <QLayoutItem>
#include <QFont>
#include <QPushButton>
#include <QCheckBox>
#include <QFormLayout>
#include <QObject>
#include <string>
#include <QBrush>
26
#include <QWindow>
27
#include <QMessageBox>
Victor Blanchet's avatar
Victor Blanchet committed
28
29
30
31
32
33
34

#include <array>
#include <iostream>
#include <iomanip>

using namespace std;

35
36
std::unique_ptr<AutoCell> AutoCell::instance = nullptr;

Victor Blanchet's avatar
Victor Blanchet committed
37
38
AutoCell::AutoCell(QWidget* parent):QWidget(parent)
{
39
40
this->setWindowTitle("Automate cellulaire");
    this->setMinimumSize(1000, 650);
Victor Blanchet's avatar
Victor Blanchet committed
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

    //division en frame de la fenêtre de l'application

    general = new QGridLayout;

    this->setLayout(general);

    //définition de la frame choix du modèle

    win_model_choice = new QWidget;
    win_model_choice->setStyleSheet("background-color: rgb(204, 209, 209)");
    win_model_choice->setFixedSize(300, 100);

    lab_model_choice = new QLabel("Choisir un modèle dans la liste ou \nen paramétrer un nouveau :", win_model_choice);

    button_add_model = new QPushButton("Ajouter un modèle");
Boris Cazic's avatar
Boris Cazic committed
57
    button_add_model->setToolTip("Configurer un nouveau modèle");
Victor Blanchet's avatar
Victor Blanchet committed
58
    button_add_model->setStyleSheet("background-color : rgb(251, 252, 252 )");
Boris Cazic's avatar
Boris Cazic committed
59
    button_add_model->setFixedWidth(140);
Boris Cazic's avatar
Boris Cazic committed
60

61
    connect(button_add_model, SIGNAL(clicked()), this, SLOT(defNouveauModele()));
Boris Cazic's avatar
Boris Cazic committed
62

Boris Cazic's avatar
Boris Cazic committed
63
64
    liste = new QComboBox(win_model_choice);
    liste->setPlaceholderText("--- select ---");
65

Boris Cazic's avatar
Boris Cazic committed
66
    // récupération des automates en mémoire
Victor Blanchet's avatar
Victor Blanchet committed
67

Leon Do Castelo's avatar
Leon Do Castelo committed
68
69
70
71
    std::vector<QString> noms_modeles = Database::getInstance().getAutomates();
    for(size_t i = 0 ; i<noms_modeles.size() ; i++){
        liste->addItem(noms_modeles[i]);
    }
Boris Cazic's avatar
Boris Cazic committed
72

Victor Blanchet's avatar
Victor Blanchet committed
73
    liste->setStyleSheet("background-color : rgb(251, 252, 252 )");
74
    liste->setFixedWidth(140);
Victor Blanchet's avatar
Victor Blanchet committed
75
76

    connect(liste,SIGNAL(currentIndexChanged(int)),this,SLOT(RAZ()));
Leon Do Castelo's avatar
Leon Do Castelo committed
77
    connect(liste,SIGNAL(currentIndexChanged(int)),this,SLOT(chargerGrilles()));
78
    connect(liste,SIGNAL(currentTextChanged(const QString&)),this,SLOT(initAutomate(const QString&)));
Boris Cazic's avatar
Boris Cazic committed
79

Victor Blanchet's avatar
Victor Blanchet committed
80
81
82

    grid_model_choice = new QGridLayout(win_model_choice);
    grid_model_choice->addWidget(lab_model_choice, 0, 0, 1, 2);
Victor Blanchet's avatar
Victor Blanchet committed
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
    grid_model_choice->addWidget(liste, 1,0,1,1);
    grid_model_choice->addWidget(button_add_model,1,1);

    general->addWidget(win_model_choice,0,0);

    //définition de la frame initialisation

    win_init = new QWidget;
    win_init->setFixedWidth(400);
    lab_init = new QLabel("Configuration du modèle :");

    form_init = new QGridLayout(win_init);

    form_saved_grids = new QFormLayout;
    form_config = new QFormLayout;

    form_init->addLayout(form_saved_grids, 1,1);
    form_init->addLayout(form_config, 1,0);

    list_grids = new QComboBox;
    check_load_grid = new QCheckBox;

    edit_largeur = new QLineEdit;
    edit_largeur->setFixedWidth(30);
    edit_hauteur= new QLineEdit;
    edit_hauteur->setFixedWidth(30);
    check_aleatoire = new QCheckBox;
    button_valide_init = new QPushButton("Valider");
    button_valide_init->setFixedWidth(50);

    connect(button_valide_init,SIGNAL(clicked()),this,SLOT(initialiserGrille()));

    form_saved_grids->addRow(tr("Importer une grille"), check_load_grid);
    form_saved_grids->addRow(tr("Grilles enregistrées"), list_grids);
    form_saved_grids->addWidget(button_valide_init);

    form_config->addRow(tr("Largeur :"), edit_largeur);
    form_config->addRow(tr("Hauteur :"), edit_hauteur);
    form_config->addRow(tr("Remplissage aléatoire"), check_aleatoire);

    form_init->addWidget(lab_init,0,0,1,3);

    general->addWidget(win_init,0,1,1,2);

    //définition de la frame "panneau de contrôle de l'exécution"

    win_run_ctrl = new QWidget;
    win_run_ctrl->setFixedWidth(300);
    lab_run_crtl = new QLabel("Outils de contrôle :");
    win_run_ctrl->setStyleSheet("background-color: rgb(174, 182, 191)");


    grid_run_control = new QGridLayout(win_run_ctrl);
136

137
138
    grid_run_control->setColumnMinimumWidth(1,80);
    grid_run_control->setColumnMinimumWidth(2,80);
Boris Cazic's avatar
Boris Cazic committed
139
    grid_run_control->setRowMinimumHeight(3,80);
140
    grid_run_control->setRowMinimumHeight(7,300);
Boris Cazic's avatar
Boris Cazic committed
141
142

    grid_run_control->addWidget(lab_run_crtl, 0,0,1,3,Qt::AlignTop);
143

144
145
146
    matriceTorique = new QCheckBox("Matrice torique");
    connect(matriceTorique, SIGNAL(stateChanged(int)), this, SLOT(setMatriceTorique(int)));

147
    lab_time_step = new QLabel("Pas de temps : ");
Victor Blanchet's avatar
Victor Blanchet committed
148
149
150
151
152
    spin_time_step = new QSpinBox;
    spin_time_step->setStyleSheet("background-color: rgb(255,255,255)");
    spin_time_step->setFixedWidth(70);
    spin_time_step->setValue(1000);
    spin_time_step->setRange(500,2500);
153
    connect(spin_time_step, SIGNAL(valueChanged()), this, SLOT(changeDelai()));
154
155
156
    button_prev = new QPushButton("<<");
    button_prev->setStyleSheet("background-color: rgb(255,255,255)");
    button_prev->setFixedSize(40,40);
Romain De Laage De Bellefaye's avatar
Romain De Laage De Bellefaye committed
157
    connect(button_prev, SIGNAL(clicked()), this, SLOT(previous()));
158
159
160
    button_run = new QPushButton("RUN");
    button_run->setFixedSize(40,40);
    button_run->setStyleSheet("background-color: rgb(255,255,255)");
Boris Cazic's avatar
Boris Cazic committed
161
    connect(button_run, SIGNAL(clicked()), this, SLOT(gererSimulation()));
162
163
164
    button_next = new QPushButton(">>");
    button_next->setFixedSize(40,40);
    button_next->setStyleSheet("background-color: rgb(255,255,255)");
Romain De Laage De Bellefaye's avatar
Romain De Laage De Bellefaye committed
165
    connect(button_next, SIGNAL(clicked()), this, SLOT(next()));
Boris Cazic's avatar
Boris Cazic committed
166
167
168
    button_reinitialiser = new QPushButton("Réinitialiser la simulation");
    button_reinitialiser->setStyleSheet("background-color: rgb(255,255,255)");
    button_reinitialiser->setFixedWidth(200);
Leon Do Castelo's avatar
Leon Do Castelo committed
169
    connect(button_reinitialiser, SIGNAL(clicked()), this, SLOT(reinitialiserSimulation()));
170

171
172
173
174
175
176
177
178
179
180
181
182
183
184
    lab_nb_step = new QLabel("Nombre d'étapes : ");
    edit_nb_step = new QLineEdit;
    edit_nb_step->setReadOnly(true);
    edit_nb_step->setFixedWidth(30);
    edit_nb_step->setText("0");
    edit_nb_step->setStyleSheet("background-color: rgb(255,255,255)");
    lab_periode = new QLabel("Période observée : ");
    edit_periode = new QLineEdit;
    edit_periode->setReadOnly(true);
    edit_periode->setFixedWidth(30);
    edit_periode->setText("0");
    edit_periode->setStyleSheet("background-color: rgb(255,255,255)");

    grid_run_control->addWidget(matriceTorique, 1, 0, Qt::AlignCenter);
Victor Blanchet's avatar
Victor Blanchet committed
185
    grid_run_control->addWidget(lab_time_step, 2, 0);
186
    grid_run_control->addWidget(spin_time_step, 2, 1);
187
188
189
    grid_run_control->addWidget(button_prev, 3, 0);
    grid_run_control->addWidget(button_run, 3, 1);
    grid_run_control->addWidget(button_next, 3, 2);
190
191
192
193
194
195
    grid_run_control->addWidget(button_reinitialiser, 4, 0, Qt::AlignTop);

    grid_run_control->addWidget(lab_nb_step, 5,0);
    grid_run_control->addWidget(edit_nb_step, 5,1);
    grid_run_control->addWidget(lab_periode,6,0);
    grid_run_control->addWidget(edit_periode,6,1);
196

197
198
199
200
201
202
203
204
205
    lab_sauv_grille = new QLabel("Sauvegarder la grille courante");
    edit_nom_grille = new QLineEdit;
    edit_nom_grille->setPlaceholderText("Entrer un nom");
    edit_nom_grille->setStyleSheet("background-color: rgb(255,255,255)");

    edit_nom_grille->setFixedWidth(180);

    button_save_grid = new QPushButton("sauvegarder");
    button_save_grid->setFixedWidth(90);
Leon Do Castelo's avatar
Leon Do Castelo committed
206
    connect(button_save_grid,SIGNAL(clicked()),this,SLOT(sauvegarderGrille()));
207

208
209
210
    grid_run_control->addWidget(lab_sauv_grille,7,0,1,3, Qt::AlignBottom);
    grid_run_control->addWidget(edit_nom_grille,8,0, Qt::AlignBottom);
    grid_run_control->addWidget(button_save_grid,8,2,Qt::AlignBottom);
211

Victor Blanchet's avatar
Victor Blanchet committed
212
213
    general->addWidget(win_run_ctrl,1,0,2,1);

Victor Blanchet's avatar
Victor Blanchet committed
214
215
216
217
218
219
220
    //définition de la frame affichage de la grille

    win_grid = new QWidget;

    grid = new QTableWidget(0,0,win_grid);
};

221
void AutoCell::afficherGrille(Reseau* grille)
Victor Blanchet's avatar
Victor Blanchet committed
222
{
223
	Grille.reset(new Reseau(*grille));
Victor Blanchet's avatar
Victor Blanchet committed
224
225
    win_grid = new QWidget;

226
227
    int l = Grille->getLargeur();
    int h = Grille->getHauteur();
Victor Blanchet's avatar
Victor Blanchet committed
228

Victor Blanchet's avatar
Victor Blanchet committed
229
230
    delete grid;
    grid = new QTableWidget(h,l,win_grid);
Victor Blanchet's avatar
Victor Blanchet committed
231

Boris Cazic's avatar
Boris Cazic committed
232
233
    int dim_pixels_h=40; //Taille en pixel.
    int dim_pixels_v=40;
Victor Blanchet's avatar
Victor Blanchet committed
234

Victor Blanchet's avatar
Victor Blanchet committed
235
    grid->setFixedSize((l)*dim_pixels_h, h*dim_pixels_v);
Victor Blanchet's avatar
Victor Blanchet committed
236

Victor Blanchet's avatar
Victor Blanchet committed
237
238
    grid->horizontalHeader()->setVisible(false); //Pas de nom pour les colonnes.
    grid->verticalHeader()->setVisible(false);
Victor Blanchet's avatar
Victor Blanchet committed
239
240
241
    grid->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); //Pas de barre pour scroller.
    grid->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

Boris Cazic's avatar
Boris Cazic committed
242
243
    grid->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);

Victor Blanchet's avatar
Victor Blanchet committed
244
245
    QFont serifFont("Times", 8, QFont::DemiBold);

Romain De Laage De Bellefaye's avatar
Romain De Laage De Bellefaye committed
246
247
    for(int i=0; i < h; ++i) {
            for(int j=0; j < l; ++j) {
Victor Blanchet's avatar
Victor Blanchet committed
248
            //vérifier si les cellules ont ou non été générés (!= nullptr)
Victor Blanchet's avatar
Victor Blanchet committed
249
            QString indice; indice.setNum(Grille->getReseau()[i][j].getIndEtat());
Victor Blanchet's avatar
Victor Blanchet committed
250

251
            QString label; label = QString::fromStdString(Automate::getInstance().getEnsemble().getEtat(indice.toInt()).getLabel()); //label de la cellule
Victor Blanchet's avatar
Victor Blanchet committed
252

Victor Blanchet's avatar
Victor Blanchet committed
253
254
            grid->setItem(i, j, new QTableWidgetItem(indice));
            grid->item(i,j)->setFlags(Qt::ItemIsEnabled);
255
            grid->item(i,j)->setToolTip(label);
Victor Blanchet's avatar
Victor Blanchet committed
256

Victor Blanchet's avatar
Victor Blanchet committed
257
            //afficherCellule
Victor Blanchet's avatar
Victor Blanchet committed
258

259
            QColor color; color = Automate::getInstance().getEnsemble().getEtat(indice.toInt()).getColor();
Victor Blanchet's avatar
Victor Blanchet committed
260
261
262
263

            QBrush brush_color;
            brush_color.setColor(color);

Victor Blanchet's avatar
Victor Blanchet committed
264
            grid->item(i,j)->setBackground(brush_color.color());
Victor Blanchet's avatar
Victor Blanchet committed
265
266
            grid->item(i,j)->setForeground(Qt::black);
            grid->item(i,j)->setFont(serifFont);
Boris Cazic's avatar
Boris Cazic committed
267
            grid->setColumnWidth(j,40);
Victor Blanchet's avatar
Victor Blanchet committed
268
        }
Boris Cazic's avatar
Boris Cazic committed
269
    grid->setRowHeight(i,40);
Victor Blanchet's avatar
Victor Blanchet committed
270
    }
Victor Blanchet's avatar
Victor Blanchet committed
271
    connect(grid,SIGNAL(clicked(const QModelIndex&)),this,SLOT(modifierCellule(const QModelIndex&)));
Victor Blanchet's avatar
Victor Blanchet committed
272
    general->addWidget(win_grid,1,1,2,2);
273
274
275

    edit_nb_step->setText(to_string(Automate::getInstance().getNbStep()).c_str());
    edit_periode->setText(to_string(Automate::getInstance().getNbCycle()).c_str());
Victor Blanchet's avatar
Victor Blanchet committed
276
277
278
279
};


void AutoCell::initialiserGrille(){
Victor Blanchet's avatar
Victor Blanchet committed
280
    bool ok;
Victor Blanchet's avatar
Victor Blanchet committed
281
282
283
284
285

    int l = (edit_largeur->text()).toInt(&ok, 10);
    int h = (edit_hauteur->text()).toInt(&ok, 10);

    QString str_l; str_l.setNum(l);
Victor Blanchet's avatar
Victor Blanchet committed
286
287
    QString str_h; str_h.setNum(h);

Leon Do Castelo's avatar
Leon Do Castelo committed
288
    if((0>=h || h>21 || 0>=l || l>41) && !check_load_grid->isChecked()){
289
290
291
292
293
294
295
        QString msg("erreur dimensions");
        afficherErreur(msg);
        edit_largeur->setText("");
        edit_hauteur->setText("");
        return;
    }

296
    Reseau grille = Reseau(h,l);
Victor Blanchet's avatar
Victor Blanchet committed
297

Romain De Laage De Bellefaye's avatar
Romain De Laage De Bellefaye committed
298
    if (check_aleatoire->isChecked())
299
	    grille.setAleatoire();
Victor Blanchet's avatar
Victor Blanchet committed
300

Boris Cazic's avatar
Boris Cazic committed
301
    QString nom_grille = list_grids->currentText();
Leon Do Castelo's avatar
Leon Do Castelo committed
302
303

    if (check_load_grid->isChecked()) {
304
      grille = Reseau(Database::getInstance().getReseau(listeGrille[list_grids->currentIndex()*2].toInt()));
Boris Cazic's avatar
Boris Cazic committed
305
      QString str_largeur;
Leon Do Castelo's avatar
Leon Do Castelo committed
306
      //str_largeur.setNum(listeGrille[list_grids->currentIndex()*2].toInt());
Boris Cazic's avatar
Boris Cazic committed
307
      QString str_hauteur;
Leon Do Castelo's avatar
Leon Do Castelo committed
308
      //edit_largeur->setText(str_largeur);
309
310
      edit_largeur->setText(str_largeur.setNum(grille.getLargeur(),10));
      edit_hauteur->setText(str_hauteur.setNum(grille.getHauteur(),10));
Leon Do Castelo's avatar
Leon Do Castelo committed
311
      }
Victor Blanchet's avatar
Victor Blanchet committed
312

313
314
    this->afficherGrille(&grille);
    Automate::getInstance().setReseauInit(grille);
Romain De Laage De Bellefaye's avatar
Romain De Laage De Bellefaye committed
315
    Automate::getInstance().initialiserBuffer();
Boris Cazic's avatar
Boris Cazic committed
316
};
Victor Blanchet's avatar
Victor Blanchet committed
317
318
319
void AutoCell::RAZ(){
    delete grid;
    grid = new QTableWidget(0,0,win_grid);
Victor Blanchet's avatar
Victor Blanchet committed
320
321
    edit_largeur->setText("");
    edit_hauteur->setText("");
Victor Blanchet's avatar
Victor Blanchet committed
322
323
    edit_nb_step->setText("0");
    edit_periode->setText("0");
Victor Blanchet's avatar
Victor Blanchet committed
324
    spin_time_step->setValue(1000);
Boris Cazic's avatar
Boris Cazic committed
325
326
    check_aleatoire->setCheckState(Qt::Unchecked);
    check_load_grid->setCheckState(Qt::Unchecked);
327
;}
Victor Blanchet's avatar
Victor Blanchet committed
328

Boris Cazic's avatar
Boris Cazic committed
329
void AutoCell::defNouveauModele() {
Leon Do Castelo's avatar
Leon Do Castelo committed
330
    Automate::getInstance().reinitialiserAutomate();
Boris Cazic's avatar
Boris Cazic committed
331
332
333
334
    NouveauModele* nouveaumodele = new NouveauModele;
    nouveaumodele->show();
}

Victor Blanchet's avatar
Victor Blanchet committed
335
336
337
338
339
340
341
342
343
344
void AutoCell::modifierCellule(const QModelIndex& index) {
    unsigned int i = index.row();
    unsigned int j = index.column();

    Grille->getReseau()[i][j].incrementerEtat();

    unsigned int indice = (Grille->getReseau()[i][j].getIndEtat());

    QString str_indice ; str_indice.setNum(indice, 10);

345
    QColor color; color = Automate::getInstance().getEnsemble().getEtat(indice).getColor();
Victor Blanchet's avatar
Victor Blanchet committed
346
347
348
349
350
351
352

    QBrush brush_color;
    brush_color.setColor(color);

    grid->item(i,j)->setBackground(brush_color.color());
    grid->item(i,j)->setText(str_indice);

Boris Cazic's avatar
Boris Cazic committed
353
    //réitnitialiser l'automate ou modif du buffer d
354
355
356
    Automate::getInstance().reset();
    Automate::getInstance().setReseauInit(*Grille);
    Automate::getInstance().initialiserBuffer();
Boris Cazic's avatar
Boris Cazic committed
357
}
Victor Blanchet's avatar
Victor Blanchet committed
358

359
void AutoCell::sauvegarderGrille(){
360
361
362
363
364
365
366
367
368
369
     if(edit_nom_grille->text()==""){
        QString msg("Entrer un nom");
        afficherErreur(msg);
        return;
    }
    QString nom_grille;
    nom_grille = edit_nom_grille->text();
    QString nom_automate;
    nom_automate = liste->currentText();
    Database::getInstance().stockerReseau(*Grille, nom_grille, nom_automate);
Victor Blanchet's avatar
Victor Blanchet committed
370
    edit_nom_grille->setText("");
Victor Blanchet's avatar
Victor Blanchet committed
371
372
373
    QMessageBox messageBox;
    messageBox.critical(0,"Confirmation", "Grille enregistrée");
    messageBox.setFixedSize(500,200);
374
375
};

Leon Do Castelo's avatar
Leon Do Castelo committed
376
void AutoCell::chargerGrilles(){
Leon Do Castelo's avatar
Leon Do Castelo committed
377
    listeGrille.clear();
Leon Do Castelo's avatar
Leon Do Castelo committed
378
379
380
381
    QString text;
    QString nb;
    text = liste->currentText();

Boris Cazic's avatar
Boris Cazic committed
382
    list_grids->clear();
383
    list_grids->setFixedWidth(90);
Leon Do Castelo's avatar
Leon Do Castelo committed
384
385
386
    vector<QString> noms = Database::getInstance().getListeReseaux(text);
    nb.setNum(noms.size());

Leon Do Castelo's avatar
Leon Do Castelo committed
387
    for(size_t i=1 ; i<noms.size() ; i = i + 2)
Leon Do Castelo's avatar
Leon Do Castelo committed
388
        list_grids->addItem(noms[i]);
Leon Do Castelo's avatar
Leon Do Castelo committed
389
    listeGrille = noms;
Boris Cazic's avatar
Boris Cazic committed
390
391
392
393
394
}

void AutoCell::gererSimulation(){
    if(button_run->text() == "RUN"){
        button_run->setText("STOP");
395
        Automate::getInstance().start();
Boris Cazic's avatar
Boris Cazic committed
396
397
398
    }
    else {
        button_run->setText("RUN");
399
        Automate::getInstance().pause();
Boris Cazic's avatar
Boris Cazic committed
400
    }
Victor Blanchet's avatar
Victor Blanchet committed
401
}
402

403
404
405
406
407
void AutoCell::afficherErreur(QString& msg){
    QMessageBox messageBox;
    messageBox.critical(0,"Error",msg);
    messageBox.setFixedSize(500,200);
}
408
409

void AutoCell::initAutomate(const QString& name) {
410
411
412
413
414
415
416
	try {
		Database::getInstance().initSingletonAutomate(name);
	}
	catch(const char* m) {
		QString msg(m);
		afficherErreur(msg);
	}
417
418
	Automate::getInstance().setMatriceTorique(true);
	matriceTorique->setCheckState(Qt::Checked);
419
}
Romain De Laage De Bellefaye's avatar
Romain De Laage De Bellefaye committed
420

421
422
void AutoCell::changeDelai() {
    Automate::getInstance().setDelai(static_cast<unsigned int>(spin_time_step->value()));
Romain De Laage De Bellefaye's avatar
Romain De Laage De Bellefaye committed
423
424
425
426
427
428
429
}

void AutoCell::next() {
	Automate::getInstance().step();
}

void AutoCell::previous() {
430
431
432
433
434
435
436
437
	try {
		Automate::getInstance().previous();
	}
	catch (const char* m)
	{
		QString msg(m);
		afficherErreur(msg);
	}
Romain De Laage De Bellefaye's avatar
Romain De Laage De Bellefaye committed
438
}
439
440
441
442
443
444
445

void AutoCell::setMatriceTorique(int val) {
	if (val == 0)
		Automate::getInstance().setMatriceTorique(false);
	else
		Automate::getInstance().setMatriceTorique(true);
}
Leon Do Castelo's avatar
Leon Do Castelo committed
446
447
448
449
450
451
452

void AutoCell::reinitialiserSimulation()
{
    Automate::getInstance().reset();
    afficherGrille(&Automate::getInstance().getReseauInit());
}