Verified Commit decb8ff0 authored by Romain De Laage De Bellefaye's avatar Romain De Laage De Bellefaye 🌳
Browse files

Fix a few mistakes

parent dbfbe957
......@@ -67,14 +67,14 @@ public:
class RegleVoisinage{
public :
virtual void calculVoisinage(Voisinage& v, const Reseau& r) = 0;
virtual void calculVoisinage(Voisinage& v, const Reseau& r) const = 0;
};
class RegleVoisinageNeumann : public RegleVoisinage {
private:
unsigned int rayon;
public:
void calculVoisinage(Voisinage& v, const Reseau& r) override;
void calculVoisinage(Voisinage& v, const Reseau& r) const override;
void setr(unsigned int r);
unsigned int getr() const { return rayon; }
};
......@@ -83,7 +83,7 @@ class RegleVoisinageMoore : public RegleVoisinage {
private:
unsigned int rayon;
public:
void calculVoisinage(Voisinage& v, const Reseau& r) override;
void calculVoisinage(Voisinage& v, const Reseau& r) const override;
void setr(unsigned int r);
unsigned int getr() const { return rayon; }
};
......
......@@ -170,16 +170,16 @@ RegleVoisinage* Database::getRegleVoisinage(const QString& name) const {
if(query.isNull("rayon"))
throw "Error: r can't be undefined here";
RegleVoisinage *regle = new RegleVoisinageNeumann;
regle->setNbVoisins(query.value("rayon").toInt());
RegleVoisinageNeumann *regle = new RegleVoisinageNeumann;
regle->setr(query.value("rayon").toInt());
return regle;
} else if(type == 2) {
if(query.isNull("rayon"))
throw "Error: r can't be undefined here";
RegleVoisinage *regle = new RegleVoisinageMoore;
regle->setNbVoisins(query.value("rayon").toInt());
RegleVoisinageMoore *regle = new RegleVoisinageMoore;
regle->setr(query.value("rayon").toInt());
return regle;
} else if(type != 3) // n'existe pas
......@@ -192,7 +192,7 @@ RegleVoisinage* Database::getRegleVoisinage(const QString& name) const {
if(!query.first())
throw "There must be at least one coord in this rule";
RegleVoisinage *regle = new RegleVoisinage;
RegleVoisinageArbitraire *regle = new RegleVoisinageArbitraire;
do {
/// @todo voisinage arbitraire
......@@ -269,8 +269,8 @@ Reseau& Database::getReseau(int idReseau) const
cellule.prepare("SELECT etat FROM Cellules WHERE (reseau = :id AND ensemble = :idE AND x = :i AND y = :j)");
cellule.bindValue(":id", idReseau);
cellule.bindValue(":idE", idEnsemble);
cellule.bindValue(":i", i);
cellule.bindValue(":j", j);
cellule.bindValue(":i", static_cast<int>(i));
cellule.bindValue(":j", static_cast<int>(j));
cellule.exec();
while(r->getReseau()[i][j].getIndEtat() != cellule.value("etat").toInt())
r->getReseau()[i][j].incrementerEtat();
......
......@@ -17,7 +17,7 @@ void RegleVoisinageMoore::setr(unsigned int r){
throw ("Rayon incorrect !\n");
}
void RegleVoisinageNeumann::calculVoisinage(Voisinage& v, const Reseau& r) {
void RegleVoisinageNeumann::calculVoisinage(Voisinage& v, const Reseau& r) const {
v.voisinage = std::vector<Cellule*>();
int nb = 0;
unsigned int cellX = v.celluleCentre->abs;
......@@ -31,7 +31,7 @@ void RegleVoisinageNeumann::calculVoisinage(Voisinage& v, const Reseau& r) {
v.voisinage.push_back(&r.getReseau()[(cellY+i)%hauteur][(cellX+j)%largeur]);
}
void RegleVoisinageMoore::calculVoisinage(Voisinage& v, const Reseau& r) {
void RegleVoisinageMoore::calculVoisinage(Voisinage& v, const Reseau& r) const {
v.voisinage = std::vector<Cellule*>();
int nb = 0;
unsigned int cellX = v.celluleCentre->abs;
......
Supports Markdown
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