autocell.cpp 14.1 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);
169

170
171
172
173
174
175
176
177
178
179
180
181
182
183
    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
184
    grid_run_control->addWidget(lab_time_step, 2, 0);
185
    grid_run_control->addWidget(spin_time_step, 2, 1);
186
187
188
    grid_run_control->addWidget(button_prev, 3, 0);
    grid_run_control->addWidget(button_run, 3, 1);
    grid_run_control->addWidget(button_next, 3, 2);
189
190
191
192
193
194
    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);
195

196
197
198
199
200
201
202
203
204
    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
205
    connect(button_save_grid,SIGNAL(clicked()),this,SLOT(sauvegarderGrille()));
206

207
208
209
    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);
210

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

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

    win_grid = new QWidget;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            QBrush brush_color;
            brush_color.setColor(color);

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


void AutoCell::initialiserGrille(){
Victor Blanchet's avatar
Victor Blanchet committed
276
    bool ok;
Victor Blanchet's avatar
Victor Blanchet committed
277
278
279
280
281

    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
282
283
    QString str_h; str_h.setNum(h);

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

292
    Reseau grille = Reseau(h,l);
Victor Blanchet's avatar
Victor Blanchet committed
293

Romain De Laage De Bellefaye's avatar
Romain De Laage De Bellefaye committed
294
    if (check_aleatoire->isChecked())
295
	    grille.setAleatoire();
Victor Blanchet's avatar
Victor Blanchet committed
296

Boris Cazic's avatar
Boris Cazic committed
297
    QString nom_grille = list_grids->currentText();
Leon Do Castelo's avatar
Leon Do Castelo committed
298
299

    if (check_load_grid->isChecked()) {
300
      grille = Reseau(Database::getInstance().getReseau(listeGrille[list_grids->currentIndex()*2].toInt()));
Boris Cazic's avatar
Boris Cazic committed
301
      QString str_largeur;
Leon Do Castelo's avatar
Leon Do Castelo committed
302
      //str_largeur.setNum(listeGrille[list_grids->currentIndex()*2].toInt());
Boris Cazic's avatar
Boris Cazic committed
303
      QString str_hauteur;
Leon Do Castelo's avatar
Leon Do Castelo committed
304
      //edit_largeur->setText(str_largeur);
305
306
      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
307
      }
Victor Blanchet's avatar
Victor Blanchet committed
308

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

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

Victor Blanchet's avatar
Victor Blanchet committed
331
332
333
334
335
336
337
338
339
340
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);

341
    QColor color; color = Automate::getInstance().getEnsemble().getEtat(indice).getColor();
Victor Blanchet's avatar
Victor Blanchet committed
342
343
344
345
346
347
348

    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
349
    //réitnitialiser l'automate ou modif du buffer d
350
351
352
    Automate::getInstance().reset();
    Automate::getInstance().setReseauInit(*Grille);
    Automate::getInstance().initialiserBuffer();
Boris Cazic's avatar
Boris Cazic committed
353
}
Victor Blanchet's avatar
Victor Blanchet committed
354

355
void AutoCell::sauvegarderGrille(){
356
357
358
359
360
361
362
363
364
365
     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
366
    edit_nom_grille->setText("");
Victor Blanchet's avatar
Victor Blanchet committed
367
368
369
    QMessageBox messageBox;
    messageBox.critical(0,"Confirmation", "Grille enregistrée");
    messageBox.setFixedSize(500,200);
370
371
};

Leon Do Castelo's avatar
Leon Do Castelo committed
372
void AutoCell::chargerGrilles(){
Leon Do Castelo's avatar
Leon Do Castelo committed
373
    listeGrille.clear();
Leon Do Castelo's avatar
Leon Do Castelo committed
374
375
376
377
    QString text;
    QString nb;
    text = liste->currentText();

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

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

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

399
400
401
402
403
void AutoCell::afficherErreur(QString& msg){
    QMessageBox messageBox;
    messageBox.critical(0,"Error",msg);
    messageBox.setFixedSize(500,200);
}
404
405

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

417
418
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
419
420
421
422
423
424
425
}

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

void AutoCell::previous() {
426
427
428
429
430
431
432
433
	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
434
}
435
436
437
438
439
440
441

void AutoCell::setMatriceTorique(int val) {
	if (val == 0)
		Automate::getInstance().setMatriceTorique(false);
	else
		Automate::getInstance().setMatriceTorique(true);
}