mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 23:20:52 +01:00
Classe "Borne" renommee en "Terminal"
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@45 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -13,13 +13,13 @@ QBrush Conducteur::conducer_brush = QBrush();
|
||||
@param parent Element parent du conducteur (0 par defaut)
|
||||
@param scene QGraphicsScene auquelle appartient le conducteur
|
||||
*/
|
||||
Conducteur::Conducteur(Borne *p1, Borne* p2, Element *parent, QGraphicsScene *scene) : QGraphicsPathItem(parent, scene) {
|
||||
Conducteur::Conducteur(Terminal *p1, Terminal* p2, Element *parent, QGraphicsScene *scene) : QGraphicsPathItem(parent, scene) {
|
||||
// bornes que le conducteur relie
|
||||
borne1 = p1;
|
||||
borne2 = p2;
|
||||
terminal1 = p1;
|
||||
terminal2 = p2;
|
||||
// ajout du conducteur a la liste de conducteurs de chacune des deux bornes
|
||||
bool ajout_p1 = borne1 -> addConducteur(this);
|
||||
bool ajout_p2 = borne2 -> addConducteur(this);
|
||||
bool ajout_p1 = terminal1 -> addConducteur(this);
|
||||
bool ajout_p2 = terminal2 -> addConducteur(this);
|
||||
// en cas d'echec de l'ajout (conducteur deja existant notamment)
|
||||
if (!ajout_p1 || !ajout_p2) return;
|
||||
destroyed = false;
|
||||
@@ -36,7 +36,7 @@ Conducteur::Conducteur(Borne *p1, Borne* p2, Element *parent, QGraphicsScene *sc
|
||||
pen_and_brush_initialized = true;
|
||||
}
|
||||
// calcul du rendu du conducteur
|
||||
priv_calculeConducteur(borne1 -> amarrageConducteur(), borne1 -> orientation(), borne2 -> amarrageConducteur(), borne2 -> orientation());
|
||||
priv_calculeConducteur(terminal1 -> amarrageConducteur(), terminal1 -> orientation(), terminal2 -> amarrageConducteur(), terminal2 -> orientation());
|
||||
setFlags(QGraphicsItem::ItemIsSelectable);
|
||||
}
|
||||
|
||||
@@ -46,13 +46,13 @@ Conducteur::Conducteur(Borne *p1, Borne* p2, Element *parent, QGraphicsScene *sc
|
||||
*/
|
||||
void Conducteur::update(const QRectF &rect) {
|
||||
// utilise soit la fonction priv_modifieConducteur soit la fonction priv_calculeConducteur
|
||||
void (Conducteur::* fonction_update) (const QPointF &, Borne::Orientation, const QPointF &, Borne::Orientation);
|
||||
void (Conducteur::* fonction_update) (const QPointF &, Terminal::Orientation, const QPointF &, Terminal::Orientation);
|
||||
fonction_update = (points.count() && modified_path) ? &Conducteur::priv_modifieConducteur : &Conducteur::priv_calculeConducteur;
|
||||
|
||||
// appelle la bonne fonction pour calculer l'aspect du conducteur
|
||||
(this ->* fonction_update)(
|
||||
borne1 -> amarrageConducteur(), borne1 -> orientation(),
|
||||
borne2 -> amarrageConducteur(), borne2 -> orientation()
|
||||
terminal1 -> amarrageConducteur(), terminal1 -> orientation(),
|
||||
terminal2 -> amarrageConducteur(), terminal2 -> orientation()
|
||||
);
|
||||
QGraphicsPathItem::update(rect);
|
||||
}
|
||||
@@ -64,22 +64,22 @@ void Conducteur::update(const QRectF &rect) {
|
||||
@param b Borne
|
||||
@param pos position de la borne b
|
||||
*/
|
||||
void Conducteur::updateWithNewPos(const QRectF &rect, const Borne *b, const QPointF &newpos) {
|
||||
void Conducteur::updateWithNewPos(const QRectF &rect, const Terminal *b, const QPointF &newpos) {
|
||||
QPointF p1, p2;
|
||||
if (b == borne1) {
|
||||
if (b == terminal1) {
|
||||
p1 = newpos;
|
||||
p2 = borne2 -> amarrageConducteur();
|
||||
} else if (b == borne2) {
|
||||
p1 = borne1 -> amarrageConducteur();
|
||||
p2 = terminal2 -> amarrageConducteur();
|
||||
} else if (b == terminal2) {
|
||||
p1 = terminal1 -> amarrageConducteur();
|
||||
p2 = newpos;
|
||||
} else {
|
||||
p1 = borne1 -> amarrageConducteur();
|
||||
p2 = borne2 -> amarrageConducteur();
|
||||
p1 = terminal1 -> amarrageConducteur();
|
||||
p2 = terminal2 -> amarrageConducteur();
|
||||
}
|
||||
if (points.count() && modified_path)
|
||||
priv_modifieConducteur(p1, borne1 -> orientation(), p2, borne2 -> orientation());
|
||||
priv_modifieConducteur(p1, terminal1 -> orientation(), p2, terminal2 -> orientation());
|
||||
else
|
||||
priv_calculeConducteur(p1, borne1 -> orientation(), p2, borne2 -> orientation());
|
||||
priv_calculeConducteur(p1, terminal1 -> orientation(), p2, terminal2 -> orientation());
|
||||
QGraphicsPathItem::update(rect);
|
||||
}
|
||||
|
||||
@@ -105,12 +105,12 @@ void Conducteur::pointsToPath() {
|
||||
@param p2 Coordonnees du point d'amarrage de la borne 2
|
||||
@param o2 Orientation de la borne 2
|
||||
*/
|
||||
void Conducteur::priv_modifieConducteur(const QPointF &p1, Borne::Orientation, const QPointF &p2, Borne::Orientation) {
|
||||
void Conducteur::priv_modifieConducteur(const QPointF &p1, Terminal::Orientation, const QPointF &p2, Terminal::Orientation) {
|
||||
Q_ASSERT_X(points.count() > 1, "priv_modifieConducteur", "pas de points a modifier");
|
||||
|
||||
// recupere les dernieres coordonnees connues des bornes
|
||||
QPointF old_p1 = mapFromScene(borne1 -> amarrageConducteur());
|
||||
QPointF old_p2 = mapFromScene(borne2 -> amarrageConducteur());
|
||||
QPointF old_p1 = mapFromScene(terminal1 -> amarrageConducteur());
|
||||
QPointF old_p2 = mapFromScene(terminal2 -> amarrageConducteur());
|
||||
|
||||
// recupere les coordonnees fournies des bornes
|
||||
QPointF new_p1 = mapFromScene(p1);
|
||||
@@ -120,12 +120,12 @@ void Conducteur::priv_modifieConducteur(const QPointF &p1, Borne::Orientation, c
|
||||
// sont stockees dans orig_dist_2_terms_x et orig_dist_2_terms_y
|
||||
|
||||
// calcule les distances horizontales et verticales entre les nouvelles bornes
|
||||
qreal new_dist_2_bornes_x = new_p2.x() - new_p1.x();
|
||||
qreal new_dist_2_bornes_y = new_p2.y() - new_p1.y();
|
||||
qreal new_dist_2_terminals_x = new_p2.x() - new_p1.x();
|
||||
qreal new_dist_2_terminals_y = new_p2.y() - new_p1.y();
|
||||
|
||||
// en deduit les coefficients de "redimensionnement"
|
||||
qreal coeff_x = new_dist_2_bornes_x / orig_dist_2_terms_x;
|
||||
qreal coeff_y = new_dist_2_bornes_y / orig_dist_2_terms_y;
|
||||
qreal coeff_x = new_dist_2_terminals_x / orig_dist_2_terms_x;
|
||||
qreal coeff_y = new_dist_2_terminals_y / orig_dist_2_terms_y;
|
||||
|
||||
// genere les nouveaux points
|
||||
int limite = moves_x.size() - 1;
|
||||
@@ -151,9 +151,9 @@ void Conducteur::priv_modifieConducteur(const QPointF &p1, Borne::Orientation, c
|
||||
@param p2 Coordonnees du point d'amarrage de la borne 2
|
||||
@param o2 Orientation de la borne 2
|
||||
*/
|
||||
void Conducteur::priv_calculeConducteur(const QPointF &p1, Borne::Orientation o1, const QPointF &p2, Borne::Orientation o2) {
|
||||
void Conducteur::priv_calculeConducteur(const QPointF &p1, Terminal::Orientation o1, const QPointF &p2, Terminal::Orientation o2) {
|
||||
QPointF sp1, sp2, depart, newp1, newp2, arrivee, depart0, arrivee0;
|
||||
Borne::Orientation ori_depart, ori_arrivee;
|
||||
Terminal::Orientation ori_depart, ori_arrivee;
|
||||
points.clear();
|
||||
type_trajet_x = p1.x() < p2.x();
|
||||
// mappe les points par rapport a la scene
|
||||
@@ -190,34 +190,34 @@ void Conducteur::priv_calculeConducteur(const QPointF &p1, Borne::Orientation o1
|
||||
// commence le vrai trajet
|
||||
if (depart.y() < arrivee.y()) {
|
||||
// trajet descendant
|
||||
if ((ori_depart == Borne::Nord && (ori_arrivee == Borne::Sud || ori_arrivee == Borne::Ouest)) || (ori_depart == Borne::Est && ori_arrivee == Borne::Ouest)) {
|
||||
if ((ori_depart == Terminal::Nord && (ori_arrivee == Terminal::Sud || ori_arrivee == Terminal::Ouest)) || (ori_depart == Terminal::Est && ori_arrivee == Terminal::Ouest)) {
|
||||
// cas « 3 »
|
||||
qreal ligne_inter_x = (depart.x() + arrivee.x()) / 2.0;
|
||||
points << QPointF(ligne_inter_x, depart.y());
|
||||
points << QPointF(ligne_inter_x, arrivee.y());
|
||||
} else if ((ori_depart == Borne::Sud && (ori_arrivee == Borne::Nord || ori_arrivee == Borne::Est)) || (ori_depart == Borne::Ouest && ori_arrivee == Borne::Est)) {
|
||||
} else if ((ori_depart == Terminal::Sud && (ori_arrivee == Terminal::Nord || ori_arrivee == Terminal::Est)) || (ori_depart == Terminal::Ouest && ori_arrivee == Terminal::Est)) {
|
||||
// cas « 4 »
|
||||
qreal ligne_inter_y = (depart.y() + arrivee.y()) / 2.0;
|
||||
points << QPointF(depart.x(), ligne_inter_y);
|
||||
points << QPointF(arrivee.x(), ligne_inter_y);
|
||||
} else if ((ori_depart == Borne::Nord || ori_depart == Borne::Est) && (ori_arrivee == Borne::Nord || ori_arrivee == Borne::Est)) {
|
||||
} else if ((ori_depart == Terminal::Nord || ori_depart == Terminal::Est) && (ori_arrivee == Terminal::Nord || ori_arrivee == Terminal::Est)) {
|
||||
points << QPointF(arrivee.x(), depart.y()); // cas « 2 »
|
||||
} else {
|
||||
points << QPointF(depart.x(), arrivee.y()); // cas « 1 »
|
||||
}
|
||||
} else {
|
||||
// trajet montant
|
||||
if ((ori_depart == Borne::Ouest && (ori_arrivee == Borne::Est || ori_arrivee == Borne::Sud)) || (ori_depart == Borne::Nord && ori_arrivee == Borne::Sud)) {
|
||||
if ((ori_depart == Terminal::Ouest && (ori_arrivee == Terminal::Est || ori_arrivee == Terminal::Sud)) || (ori_depart == Terminal::Nord && ori_arrivee == Terminal::Sud)) {
|
||||
// cas « 3 »
|
||||
qreal ligne_inter_y = (depart.y() + arrivee.y()) / 2.0;
|
||||
points << QPointF(depart.x(), ligne_inter_y);
|
||||
points << QPointF(arrivee.x(), ligne_inter_y);
|
||||
} else if ((ori_depart == Borne::Est && (ori_arrivee == Borne::Ouest || ori_arrivee == Borne::Nord)) || (ori_depart == Borne::Sud && ori_arrivee == Borne::Nord)) {
|
||||
} else if ((ori_depart == Terminal::Est && (ori_arrivee == Terminal::Ouest || ori_arrivee == Terminal::Nord)) || (ori_depart == Terminal::Sud && ori_arrivee == Terminal::Nord)) {
|
||||
// cas « 4 »
|
||||
qreal ligne_inter_x = (depart.x() + arrivee.x()) / 2.0;
|
||||
points << QPointF(ligne_inter_x, depart.y());
|
||||
points << QPointF(ligne_inter_x, arrivee.y());
|
||||
} else if ((ori_depart == Borne::Ouest || ori_depart == Borne::Nord) && (ori_arrivee == Borne::Ouest || ori_arrivee == Borne::Nord)) {
|
||||
} else if ((ori_depart == Terminal::Ouest || ori_depart == Terminal::Nord) && (ori_arrivee == Terminal::Ouest || ori_arrivee == Terminal::Nord)) {
|
||||
points << QPointF(depart.x(), arrivee.y()); // cas « 2 »
|
||||
} else {
|
||||
points << QPointF(arrivee.x(), depart.y()); // cas « 1 »
|
||||
@@ -240,19 +240,19 @@ void Conducteur::priv_calculeConducteur(const QPointF &p1, Borne::Orientation o1
|
||||
@param ext_size la taille de la prolongation
|
||||
@return le point correspondant a la borne apres prolongation
|
||||
*/
|
||||
QPointF Conducteur::extendTerminal(const QPointF &terminal, Borne::Orientation terminal_orientation, qreal ext_size) {
|
||||
QPointF Conducteur::extendTerminal(const QPointF &terminal, Terminal::Orientation terminal_orientation, qreal ext_size) {
|
||||
QPointF extended_terminal;
|
||||
switch(terminal_orientation) {
|
||||
case Borne::Nord:
|
||||
case Terminal::Nord:
|
||||
extended_terminal = QPointF(terminal.x(), terminal.y() - ext_size);
|
||||
break;
|
||||
case Borne::Est:
|
||||
case Terminal::Est:
|
||||
extended_terminal = QPointF(terminal.x() + ext_size, terminal.y());
|
||||
break;
|
||||
case Borne::Sud:
|
||||
case Terminal::Sud:
|
||||
extended_terminal = QPointF(terminal.x(), terminal.y() + ext_size);
|
||||
break;
|
||||
case Borne::Ouest:
|
||||
case Terminal::Ouest:
|
||||
extended_terminal = QPointF(terminal.x() - ext_size, terminal.y());
|
||||
break;
|
||||
default: extended_terminal = terminal;
|
||||
@@ -300,9 +300,9 @@ void Conducteur::paint(QPainter *qp, const QStyleOptionGraphicsItem */*qsogi*/,
|
||||
@param b La seconde orientation de Borne
|
||||
@return Un booleen a true si les deux orientations de bornes sont sur le meme axe
|
||||
*/
|
||||
bool Conducteur::surLeMemeAxe(Borne::Orientation a, Borne::Orientation b) {
|
||||
if ((a == Borne::Nord || a == Borne::Sud) && (b == Borne::Nord || b == Borne::Sud)) return(true);
|
||||
else if ((a == Borne::Est || a == Borne::Ouest) && (b == Borne::Est || b == Borne::Ouest)) return(true);
|
||||
bool Conducteur::surLeMemeAxe(Terminal::Orientation a, Terminal::Orientation b) {
|
||||
if ((a == Terminal::Nord || a == Terminal::Sud) && (b == Terminal::Nord || b == Terminal::Sud)) return(true);
|
||||
else if ((a == Terminal::Est || a == Terminal::Ouest) && (b == Terminal::Est || b == Terminal::Ouest)) return(true);
|
||||
else return(false);
|
||||
}
|
||||
|
||||
@@ -311,8 +311,8 @@ bool Conducteur::surLeMemeAxe(Borne::Orientation a, Borne::Orientation b) {
|
||||
@param a L'orientation de borne
|
||||
@return True si l'orientation de borne est horizontale, false sinon
|
||||
*/
|
||||
bool Conducteur::estHorizontale(Borne::Orientation a) {
|
||||
return(a == Borne::Est || a == Borne::Ouest);
|
||||
bool Conducteur::estHorizontale(Terminal::Orientation a) {
|
||||
return(a == Terminal::Est || a == Terminal::Ouest);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -320,8 +320,8 @@ bool Conducteur::estHorizontale(Borne::Orientation a) {
|
||||
@param a L'orientation de borne
|
||||
@return True si l'orientation de borne est verticale, false sinon
|
||||
*/
|
||||
bool Conducteur::estVerticale(Borne::Orientation a) {
|
||||
return(a == Borne::Nord || a == Borne::Sud);
|
||||
bool Conducteur::estVerticale(Terminal::Orientation a) {
|
||||
return(a == Terminal::Nord || a == Terminal::Sud);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -329,8 +329,8 @@ bool Conducteur::estVerticale(Borne::Orientation a) {
|
||||
*/
|
||||
void Conducteur::destroy() {
|
||||
destroyed = true;
|
||||
borne1 -> removeConducteur(this);
|
||||
borne2 -> removeConducteur(this);
|
||||
terminal1 -> removeConducteur(this);
|
||||
terminal2 -> removeConducteur(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
22
conducteur.h
22
conducteur.h
@@ -1,7 +1,7 @@
|
||||
#ifndef CONDUCTEUR_H
|
||||
#define CONDUCTEUR_H
|
||||
#include <QtGui>
|
||||
#include "borne.h"
|
||||
#include "terminal.h"
|
||||
class Element;
|
||||
/**
|
||||
Cette classe represente un conducteur. Un conducteur relie deux bornes d'element.
|
||||
@@ -10,12 +10,12 @@
|
||||
public:
|
||||
enum { Type = UserType + 1001 };
|
||||
virtual int type() const { return Type; }
|
||||
Conducteur(Borne *, Borne *, Element * = 0, QGraphicsScene * = 0);
|
||||
Conducteur(Terminal *, Terminal *, Element * = 0, QGraphicsScene * = 0);
|
||||
//virtual ~Conducteur();
|
||||
|
||||
void destroy();
|
||||
bool isDestroyed() const { return(destroyed); }
|
||||
void updateWithNewPos(const QRectF &, const Borne *, const QPointF &);
|
||||
void updateWithNewPos(const QRectF &, const Terminal *, const QPointF &);
|
||||
void update(const QRectF & = QRectF());
|
||||
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
|
||||
QRectF boundingRect() const;
|
||||
@@ -23,9 +23,9 @@
|
||||
static bool valideXml(QDomElement &);
|
||||
|
||||
///Premiere borne a laquelle le fil est rattache
|
||||
Borne *borne1;
|
||||
Terminal *terminal1;
|
||||
///Deuxieme borne a laquelle le fil est rattache
|
||||
Borne *borne2;
|
||||
Terminal *terminal2;
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *);
|
||||
@@ -51,12 +51,12 @@
|
||||
|
||||
void pointsToPath();
|
||||
void updatePoints();
|
||||
void priv_calculeConducteur(const QPointF &, Borne::Orientation, const QPointF &, Borne::Orientation);
|
||||
void priv_modifieConducteur(const QPointF &, Borne::Orientation, const QPointF &, Borne::Orientation);
|
||||
static QPointF extendTerminal(const QPointF &, Borne::Orientation, qreal = 12.0);
|
||||
static bool surLeMemeAxe(Borne::Orientation, Borne::Orientation);
|
||||
static bool estHorizontale(Borne::Orientation a);
|
||||
static bool estVerticale(Borne::Orientation a);
|
||||
void priv_calculeConducteur(const QPointF &, Terminal::Orientation, const QPointF &, Terminal::Orientation);
|
||||
void priv_modifieConducteur(const QPointF &, Terminal::Orientation, const QPointF &, Terminal::Orientation);
|
||||
static QPointF extendTerminal(const QPointF &, Terminal::Orientation, qreal = 12.0);
|
||||
static bool surLeMemeAxe(Terminal::Orientation, Terminal::Orientation);
|
||||
static bool estHorizontale(Terminal::Orientation a);
|
||||
static bool estVerticale(Terminal::Orientation a);
|
||||
static qreal conducer_bound(qreal tobound, qreal bound1, qreal bound2);
|
||||
static qreal conducer_bound(qreal tobound, qreal bound, bool positive);
|
||||
};
|
||||
|
||||
38
diagram.cpp
38
diagram.cpp
@@ -141,7 +141,7 @@ QDomDocument Diagram::toXml(bool diagram) {
|
||||
QDomDocument document;
|
||||
|
||||
// racine de l'arbre XML
|
||||
QDomElement racine = document.createElement("diagram");
|
||||
QDomElement racine = document.createElement("schema");
|
||||
|
||||
// proprietes du schema
|
||||
if (diagram) {
|
||||
@@ -170,15 +170,15 @@ QDomDocument Diagram::toXml(bool diagram) {
|
||||
if (diagram) liste_conducteurs << f;
|
||||
// lorsqu'on n'exporte pas tout le diagram, il faut retirer les conducteurs non selectionnes
|
||||
// et pour l'instant, les conducteurs non selectionnes sont les conducteurs dont un des elements n'est pas relie
|
||||
else if (f -> borne1 -> parentItem() -> isSelected() && f -> borne2 -> parentItem() -> isSelected()) liste_conducteurs << f;
|
||||
else if (f -> terminal1 -> parentItem() -> isSelected() && f -> terminal2 -> parentItem() -> isSelected()) liste_conducteurs << f;
|
||||
}
|
||||
}
|
||||
|
||||
// enregistrement des elements
|
||||
if (liste_elements.isEmpty()) return(document);
|
||||
int id_borne = 0;
|
||||
int id_terminal = 0;
|
||||
// table de correspondance entre les adresses des bornes et leurs ids
|
||||
QHash<Borne *, int> table_adr_id;
|
||||
QHash<Terminal *, int> table_adr_id;
|
||||
QDomElement elements = document.createElement("elements");
|
||||
QDir dossier_elmts_persos = QDir(QETApp::customElementsDir());
|
||||
foreach(Element *elmt, liste_elements) {
|
||||
@@ -196,19 +196,19 @@ QDomDocument Diagram::toXml(bool diagram) {
|
||||
element.setAttribute("sens", QString("%1").arg(elmt -> orientation()));
|
||||
|
||||
// enregistrements des bornes de chaque appareil
|
||||
QDomElement bornes = document.createElement("bornes");
|
||||
QDomElement terminals = document.createElement("bornes");
|
||||
// pour chaque enfant de l'element
|
||||
foreach(QGraphicsItem *child, elmt -> children()) {
|
||||
// si cet enfant est une borne
|
||||
if (Borne *p = qgraphicsitem_cast<Borne *>(child)) {
|
||||
if (Terminal *p = qgraphicsitem_cast<Terminal *>(child)) {
|
||||
// alors on enregistre la borne
|
||||
QDomElement borne = p -> toXml(document);
|
||||
borne.setAttribute("id", id_borne);
|
||||
table_adr_id.insert(p, id_borne ++);
|
||||
bornes.appendChild(borne);
|
||||
QDomElement terminal = p -> toXml(document);
|
||||
terminal.setAttribute("id", id_terminal);
|
||||
table_adr_id.insert(p, id_terminal ++);
|
||||
terminals.appendChild(terminal);
|
||||
}
|
||||
}
|
||||
element.appendChild(bornes);
|
||||
element.appendChild(terminals);
|
||||
|
||||
/**
|
||||
@todo appeler une methode virtuelle de la classe Element qui permettra
|
||||
@@ -223,8 +223,8 @@ QDomDocument Diagram::toXml(bool diagram) {
|
||||
QDomElement conducteurs = document.createElement("conducteurs");
|
||||
foreach(Conducteur *f, liste_conducteurs) {
|
||||
QDomElement conducteur = document.createElement("conducteur");
|
||||
conducteur.setAttribute("borne1", table_adr_id.value(f -> borne1));
|
||||
conducteur.setAttribute("borne2", table_adr_id.value(f -> borne2));
|
||||
conducteur.setAttribute("borne1", table_adr_id.value(f -> terminal1));
|
||||
conducteur.setAttribute("borne2", table_adr_id.value(f -> terminal2));
|
||||
conducteurs.appendChild(conducteur);
|
||||
}
|
||||
racine.appendChild(conducteurs);
|
||||
@@ -264,8 +264,8 @@ bool Diagram::fromXml(QDomDocument &document, QPointF position, bool consider_in
|
||||
// chargement de tous les Elements du fichier XML
|
||||
QList<Element *> elements_ajoutes;
|
||||
//uint nb_elements = 0;
|
||||
QHash< int, Borne *> table_adr_id;
|
||||
QHash< int, Borne *> &ref_table_adr_id = table_adr_id;
|
||||
QHash< int, Terminal *> table_adr_id;
|
||||
QHash< int, Terminal *> &ref_table_adr_id = table_adr_id;
|
||||
for (QDomNode node = racine.firstChild() ; !node.isNull() ; node = node.nextSibling()) {
|
||||
// on s'interesse a l'element XML "elements" (= groupe d'elements)
|
||||
QDomElement elmts = node.toElement();
|
||||
@@ -324,8 +324,8 @@ bool Diagram::fromXml(QDomDocument &document, QPointF position, bool consider_in
|
||||
int id_p2 = f.attribute("borne2").toInt();
|
||||
if (table_adr_id.contains(id_p1) && table_adr_id.contains(id_p2)) {
|
||||
// pose le conducteur... si c'est possible
|
||||
Borne *p1 = table_adr_id.value(id_p1);
|
||||
Borne *p2 = table_adr_id.value(id_p2);
|
||||
Terminal *p1 = table_adr_id.value(id_p1);
|
||||
Terminal *p2 = table_adr_id.value(id_p2);
|
||||
if (p1 != p2) {
|
||||
bool peut_poser_conducteur = true;
|
||||
bool cia = ((Element *)p2 -> parentItem()) -> connexionsInternesAcceptees();
|
||||
@@ -344,7 +344,7 @@ bool Diagram::fromXml(QDomDocument &document, QPointF position, bool consider_in
|
||||
@param table_id_adr Table de correspondance entre les entiers et les bornes
|
||||
@return true si l'ajout a parfaitement reussi, false sinon
|
||||
*/
|
||||
Element *Diagram::elementFromXml(QDomElement &e, QHash<int, Borne *> &table_id_adr) {
|
||||
Element *Diagram::elementFromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr) {
|
||||
// cree un element dont le type correspond à l'id type
|
||||
QString type = e.attribute("type");
|
||||
QString chemin_fichier = QETApp::realPath(type);
|
||||
@@ -364,7 +364,7 @@ Element *Diagram::elementFromXml(QDomElement &e, QHash<int, Borne *> &table_id_a
|
||||
bool conv_ok;
|
||||
int read_ori = e.attribute("sens").toInt(&conv_ok);
|
||||
if (!conv_ok || read_ori < 0 || read_ori > 3) read_ori = nvel_elmt -> defaultOrientation();
|
||||
nvel_elmt -> setOrientation((Borne::Orientation)read_ori);
|
||||
nvel_elmt -> setOrientation((Terminal::Orientation)read_ori);
|
||||
nvel_elmt -> setSelected(e.attribute("selected") == "selected");
|
||||
}
|
||||
return(retour ? nvel_elmt : NULL);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "qetapp.h"
|
||||
#include "borderinset.h"
|
||||
class Element;
|
||||
class Borne;
|
||||
class Terminal;
|
||||
class Diagram : public QGraphicsScene {
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -35,7 +35,7 @@
|
||||
private:
|
||||
QGraphicsLineItem *poseur_de_conducteur;
|
||||
bool doit_dessiner_grille;
|
||||
Element *elementFromXml(QDomElement &, QHash<int, Borne *> &);
|
||||
Element *elementFromXml(QDomElement &, QHash<int, Terminal *> &);
|
||||
|
||||
private slots:
|
||||
void slot_checkSelectionChange();
|
||||
|
||||
@@ -98,7 +98,7 @@ void DiagramView::supprimer() {
|
||||
// pour chaque enfant de l'element
|
||||
foreach (QGraphicsItem *child, qgi -> children()) {
|
||||
// si cet enfant est une borne
|
||||
if (Borne *p = qgraphicsitem_cast<Borne *>(child)) {
|
||||
if (Terminal *p = qgraphicsitem_cast<Terminal *>(child)) {
|
||||
// alors chaque conducteur de la borne est recense
|
||||
foreach (Conducteur *f, p -> conducteurs()) {
|
||||
if (!garbage_conducteurs.contains(f)) garbage_conducteurs.append(f);
|
||||
|
||||
10
element.cpp
10
element.cpp
@@ -8,7 +8,7 @@
|
||||
Constructeur pour un element sans scene ni parent
|
||||
*/
|
||||
Element::Element(QGraphicsItem *parent, Diagram *scene) : QGraphicsItem(parent, scene) {
|
||||
peut_relier_ses_propres_bornes = false;
|
||||
peut_relier_ses_propres_terminals = false;
|
||||
setZValue(10);
|
||||
}
|
||||
|
||||
@@ -107,17 +107,17 @@ QPixmap Element::pixmap() {
|
||||
QVariant Element::itemChange(GraphicsItemChange change, const QVariant &value) {
|
||||
if (change == QGraphicsItem::ItemPositionChange) {
|
||||
foreach(QGraphicsItem *qgi, children()) {
|
||||
if (Borne *p = qgraphicsitem_cast<Borne *>(qgi)) p -> updateConducteur(value.toPointF());
|
||||
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) p -> updateConducteur(value.toPointF());
|
||||
}
|
||||
} else if (change == QGraphicsItem::ItemSelectedChange) {
|
||||
foreach(QGraphicsItem *qgi, children()) {
|
||||
if (Borne *p = qgraphicsitem_cast<Borne *>(qgi)) p -> updateConducteur();
|
||||
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) p -> updateConducteur();
|
||||
}
|
||||
}
|
||||
return(QGraphicsItem::itemChange(change, value));
|
||||
}
|
||||
|
||||
bool Element::setOrientation(Borne::Orientation o) {
|
||||
bool Element::setOrientation(Terminal::Orientation o) {
|
||||
// verifie que l'orientation demandee est acceptee
|
||||
if (!acceptOrientation(o)) return(false);
|
||||
prepareGeometryChange();
|
||||
@@ -126,7 +126,7 @@ bool Element::setOrientation(Borne::Orientation o) {
|
||||
ori = o;
|
||||
update();
|
||||
foreach(QGraphicsItem *qgi, children()) {
|
||||
if (Borne *p = qgraphicsitem_cast<Borne *>(qgi)) p -> updateConducteur();
|
||||
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) p -> updateConducteur();
|
||||
}
|
||||
return(true);
|
||||
}
|
||||
|
||||
62
element.h
62
element.h
@@ -1,7 +1,7 @@
|
||||
#ifndef ELEMENT_H
|
||||
#define ELEMENT_H
|
||||
#include <QtGui>
|
||||
#include "borne.h"
|
||||
#include "terminal.h"
|
||||
class Diagram;
|
||||
class Element : public QGraphicsItem {
|
||||
public:
|
||||
@@ -9,9 +9,9 @@
|
||||
virtual int type() const { return Type; }
|
||||
Element(QGraphicsItem * = 0, Diagram * = 0);
|
||||
|
||||
virtual int nbBornes() const = 0;
|
||||
virtual int nbBornesMin() const = 0;
|
||||
virtual int nbBornesMax() const = 0;
|
||||
virtual int nbTerminals() const = 0;
|
||||
virtual int nbTerminalsMin() const = 0;
|
||||
virtual int nbTerminalsMax() const = 0;
|
||||
virtual void paint(QPainter *, const QStyleOptionGraphicsItem *) = 0;
|
||||
virtual QString typeId() = 0;
|
||||
|
||||
@@ -29,41 +29,41 @@
|
||||
bool invertOrientation();
|
||||
void setPos(const QPointF &);
|
||||
void setPos(qreal, qreal);
|
||||
inline bool connexionsInternesAcceptees() { return(peut_relier_ses_propres_bornes); }
|
||||
inline void setConnexionsInternesAcceptees(bool cia) { peut_relier_ses_propres_bornes = cia; }
|
||||
inline bool connexionsInternesAcceptees() { return(peut_relier_ses_propres_terminals); }
|
||||
inline void setConnexionsInternesAcceptees(bool cia) { peut_relier_ses_propres_terminals = cia; }
|
||||
static bool valideXml(QDomElement &);
|
||||
virtual bool fromXml(QDomElement &, QHash<int, Borne *>&) = 0;
|
||||
virtual bool fromXml(QDomElement &, QHash<int, Terminal *>&) = 0;
|
||||
// methodes d'acces aux possibilites d'orientation
|
||||
inline Borne::Orientation orientation() { return(ori); }
|
||||
inline bool acceptOrientation(Borne::Orientation o) {
|
||||
inline Terminal::Orientation orientation() { return(ori); }
|
||||
inline bool acceptOrientation(Terminal::Orientation o) {
|
||||
switch(o) {
|
||||
case Borne::Nord: return(ori_n);
|
||||
case Borne::Est: return(ori_e);
|
||||
case Borne::Sud: return(ori_s);
|
||||
case Borne::Ouest: return(ori_w);
|
||||
case Terminal::Nord: return(ori_n);
|
||||
case Terminal::Est: return(ori_e);
|
||||
case Terminal::Sud: return(ori_s);
|
||||
case Terminal::Ouest: return(ori_w);
|
||||
default: return(false);
|
||||
}
|
||||
}
|
||||
inline Borne::Orientation defaultOrientation() { return(ori_d); }
|
||||
inline Borne::Orientation nextAcceptableOrientation() {
|
||||
Borne::Orientation retour = nextOrientation(ori);
|
||||
inline Terminal::Orientation defaultOrientation() { return(ori_d); }
|
||||
inline Terminal::Orientation nextAcceptableOrientation() {
|
||||
Terminal::Orientation retour = nextOrientation(ori);
|
||||
for (int i = 0 ; i < 4 ; ++ i) {
|
||||
if (acceptOrientation(retour)) return(retour);
|
||||
retour = nextOrientation(retour);
|
||||
}
|
||||
// on ne devrait pas arriver la : renvoi d'une valeur par defaut = nord
|
||||
return(Borne::Nord);
|
||||
return(Terminal::Nord);
|
||||
}
|
||||
inline Borne::Orientation previousAcceptableOrientation() {
|
||||
Borne::Orientation retour = previousOrientation(ori);
|
||||
inline Terminal::Orientation previousAcceptableOrientation() {
|
||||
Terminal::Orientation retour = previousOrientation(ori);
|
||||
for (int i = 0 ; i < 4 ; ++ i) {
|
||||
if (acceptOrientation(retour)) return(retour);
|
||||
retour = previousOrientation(retour);
|
||||
}
|
||||
// on ne devrait pas arriver la : renvoi d'une valeur par defaut = nord
|
||||
return(Borne::Nord);
|
||||
return(Terminal::Nord);
|
||||
}
|
||||
bool setOrientation(Borne::Orientation o);
|
||||
bool setOrientation(Terminal::Orientation o);
|
||||
|
||||
protected:
|
||||
void drawAxes(QPainter *, const QStyleOptionGraphicsItem *);
|
||||
@@ -72,21 +72,21 @@
|
||||
bool ori_s;
|
||||
bool ori_e;
|
||||
bool ori_w;
|
||||
Borne::Orientation ori_d;
|
||||
Borne::Orientation ori;
|
||||
Terminal::Orientation ori_d;
|
||||
Terminal::Orientation ori;
|
||||
|
||||
private:
|
||||
bool peut_relier_ses_propres_bornes;
|
||||
bool peut_relier_ses_propres_terminals;
|
||||
void drawSelection(QPainter *, const QStyleOptionGraphicsItem *);
|
||||
void updatePixmap();
|
||||
inline Borne::Orientation nextOrientation(Borne::Orientation o) {
|
||||
if (o < 0 || o > 2) return(Borne::Nord);
|
||||
return((Borne::Orientation)(o + 1));
|
||||
inline Terminal::Orientation nextOrientation(Terminal::Orientation o) {
|
||||
if (o < 0 || o > 2) return(Terminal::Nord);
|
||||
return((Terminal::Orientation)(o + 1));
|
||||
}
|
||||
inline Borne::Orientation previousOrientation(Borne::Orientation o) {
|
||||
if (o < 0 || o > 3) return(Borne::Nord);
|
||||
if (o == Borne::Nord) return(Borne::Ouest);
|
||||
return((Borne::Orientation)(o - 1));
|
||||
inline Terminal::Orientation previousOrientation(Terminal::Orientation o) {
|
||||
if (o < 0 || o > 3) return(Terminal::Nord);
|
||||
if (o == Terminal::Nord) return(Terminal::Ouest);
|
||||
return((Terminal::Orientation)(o - 1));
|
||||
}
|
||||
|
||||
QSize dimensions;
|
||||
|
||||
@@ -8,15 +8,15 @@ ElementFixe::ElementFixe(QGraphicsItem *parent, Diagram *scene) : Element(parent
|
||||
/**
|
||||
@return Le nombre minimal de bornes que l'element peut avoir
|
||||
*/
|
||||
int ElementFixe::nbBornesMin() const {
|
||||
return(nbBornes());
|
||||
int ElementFixe::nbTerminalsMin() const {
|
||||
return(nbTerminals());
|
||||
}
|
||||
|
||||
/**
|
||||
@return Le nombre maximal de bornes que l'element peut avoir
|
||||
*/
|
||||
int ElementFixe::nbBornesMax() const {
|
||||
return(nbBornes());
|
||||
int ElementFixe::nbTerminalsMax() const {
|
||||
return(nbTerminals());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -26,43 +26,43 @@ int ElementFixe::nbBornesMax() const {
|
||||
@return true si l'import a reussi, false sinon
|
||||
|
||||
*/
|
||||
bool ElementFixe::fromXml(QDomElement &e, QHash<int, Borne *> &table_id_adr) {
|
||||
bool ElementFixe::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr) {
|
||||
/*
|
||||
les bornes vont maintenant etre recensees pour associer leurs id à leur adresse reelle
|
||||
ce recensement servira lors de la mise en place des fils
|
||||
*/
|
||||
|
||||
QList<QDomElement> liste_bornes;
|
||||
QList<QDomElement> liste_terminals;
|
||||
// parcours des enfants de l'element
|
||||
for (QDomNode enfant = e.firstChild() ; !enfant.isNull() ; enfant = enfant.nextSibling()) {
|
||||
// on s'interesse a l'element XML "bornes"
|
||||
QDomElement bornes = enfant.toElement();
|
||||
if (bornes.isNull() || bornes.tagName() != "bornes") continue;
|
||||
QDomElement terminals = enfant.toElement();
|
||||
if (terminals.isNull() || terminals.tagName() != "bornes") continue;
|
||||
// parcours des enfants de l'element XML "bornes"
|
||||
for (QDomNode node_borne = bornes.firstChild() ; !node_borne.isNull() ; node_borne = node_borne.nextSibling()) {
|
||||
for (QDomNode node_terminal = terminals.firstChild() ; !node_terminal.isNull() ; node_terminal = node_terminal.nextSibling()) {
|
||||
// on s'interesse a l'element XML "borne"
|
||||
QDomElement borne = node_borne.toElement();
|
||||
if (!borne.isNull() && Borne::valideXml(borne)) liste_bornes.append(borne);
|
||||
QDomElement terminal = node_terminal.toElement();
|
||||
if (!terminal.isNull() && Terminal::valideXml(terminal)) liste_terminals.append(terminal);
|
||||
}
|
||||
}
|
||||
|
||||
QHash<int, Borne *> priv_id_adr;
|
||||
int bornes_non_trouvees = 0;
|
||||
QHash<int, Terminal *> priv_id_adr;
|
||||
int terminals_non_trouvees = 0;
|
||||
foreach(QGraphicsItem *qgi, children()) {
|
||||
if (Borne *p = qgraphicsitem_cast<Borne *>(qgi)) {
|
||||
bool borne_trouvee = false;
|
||||
foreach(QDomElement qde, liste_bornes) {
|
||||
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) {
|
||||
bool terminal_trouvee = false;
|
||||
foreach(QDomElement qde, liste_terminals) {
|
||||
if (p -> fromXml(qde)) {
|
||||
priv_id_adr.insert(qde.attribute("id").toInt(), p);
|
||||
borne_trouvee = true;
|
||||
terminal_trouvee = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!borne_trouvee) ++ bornes_non_trouvees;
|
||||
if (!terminal_trouvee) ++ terminals_non_trouvees;
|
||||
}
|
||||
}
|
||||
|
||||
if (bornes_non_trouvees > 0) {
|
||||
if (terminals_non_trouvees > 0) {
|
||||
return(false);
|
||||
} else {
|
||||
// verifie que les associations id / adr n'entrent pas en conflit avec table_id_adr
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
class ElementFixe : public Element {
|
||||
public:
|
||||
ElementFixe(QGraphicsItem * = 0, Diagram * = 0);
|
||||
int nbBornesMin() const;
|
||||
int nbBornesMax() const;
|
||||
virtual bool fromXml(QDomElement &, QHash<int, Borne *>&);
|
||||
virtual int nbBornes() const = 0;
|
||||
int nbTerminalsMin() const;
|
||||
int nbTerminalsMax() const;
|
||||
virtual bool fromXml(QDomElement &, QHash<int, Terminal *>&);
|
||||
virtual int nbTerminals() const = 0;
|
||||
virtual void paint(QPainter *, const QStyleOptionGraphicsItem *) = 0;
|
||||
virtual QString typeId() = 0;
|
||||
virtual QString nom() = 0;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
ElementPerso::ElementPerso(QString &nom_fichier, QGraphicsItem *qgi, Diagram *s, int *etat) : ElementFixe(qgi, s) {
|
||||
nomfichier = nom_fichier;
|
||||
nb_bornes = 0;
|
||||
nb_terminals = 0;
|
||||
// pessimisme inside : par defaut, ca foire
|
||||
elmt_etat = -1;
|
||||
|
||||
@@ -157,8 +157,8 @@ ElementPerso::ElementPerso(QString &nom_fichier, QGraphicsItem *qgi, Diagram *s,
|
||||
/**
|
||||
@return Le nombre de bornes que l'element possede
|
||||
*/
|
||||
int ElementPerso::nbBornes() const {
|
||||
return(nb_bornes);
|
||||
int ElementPerso::nbTerminals() const {
|
||||
return(nb_terminals);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,7 +184,7 @@ void ElementPerso::paint(QPainter *qp, const QStyleOptionGraphicsItem *) {
|
||||
@return true si l'analyse reussit, false sinon
|
||||
*/
|
||||
bool ElementPerso::parseElement(QDomElement &e, QPainter &qp, Diagram *s) {
|
||||
if (e.tagName() == "borne") return(parseBorne(e, s));
|
||||
if (e.tagName() == "borne") return(parseTerminal(e, s));
|
||||
else if (e.tagName() == "ligne") return(parseLigne(e, qp));
|
||||
else if (e.tagName() == "ellipse") return(parseEllipse(e, qp));
|
||||
else if (e.tagName() == "cercle") return(parseCercle(e, qp));
|
||||
@@ -345,20 +345,20 @@ bool ElementPerso::parsePolygone(QDomElement &e, QPainter &qp) {
|
||||
@param s Le schema sur lequel l'element perso sera affiche
|
||||
@return true si l'analyse reussit, false sinon
|
||||
*/
|
||||
bool ElementPerso::parseBorne(QDomElement &e, Diagram *s) {
|
||||
bool ElementPerso::parseTerminal(QDomElement &e, Diagram *s) {
|
||||
// verifie la presence et la validite des attributs obligatoires
|
||||
double bornex, borney;
|
||||
Borne::Orientation borneo;
|
||||
if (!attributeIsAReal(e, QString("x"), &bornex)) return(false);
|
||||
if (!attributeIsAReal(e, QString("y"), &borney)) return(false);
|
||||
double terminalx, terminaly;
|
||||
Terminal::Orientation terminalo;
|
||||
if (!attributeIsAReal(e, QString("x"), &terminalx)) return(false);
|
||||
if (!attributeIsAReal(e, QString("y"), &terminaly)) return(false);
|
||||
if (!e.hasAttribute("orientation")) return(false);
|
||||
if (e.attribute("orientation") == "n") borneo = Borne::Nord;
|
||||
else if (e.attribute("orientation") == "s") borneo = Borne::Sud;
|
||||
else if (e.attribute("orientation") == "e") borneo = Borne::Est;
|
||||
else if (e.attribute("orientation") == "w") borneo = Borne::Ouest;
|
||||
if (e.attribute("orientation") == "n") terminalo = Terminal::Nord;
|
||||
else if (e.attribute("orientation") == "s") terminalo = Terminal::Sud;
|
||||
else if (e.attribute("orientation") == "e") terminalo = Terminal::Est;
|
||||
else if (e.attribute("orientation") == "w") terminalo = Terminal::Ouest;
|
||||
else return(false);
|
||||
new Borne(bornex, borney, borneo, this, s);
|
||||
++ nb_bornes;
|
||||
new Terminal(terminalx, terminaly, terminalo, this, s);
|
||||
++ nb_terminals;
|
||||
return(true);
|
||||
}
|
||||
|
||||
@@ -452,7 +452,7 @@ bool ElementPerso::validOrientationAttribute(QDomElement &e) {
|
||||
ori_e = (t.at(1) == 'd' || t.at(1) == 'y');
|
||||
ori_s = (t.at(2) == 'd' || t.at(2) == 'y');
|
||||
ori_w = (t.at(3) == 'd' || t.at(3) == 'y');
|
||||
ori_d = (Borne::Orientation)d_pos;
|
||||
ori_d = (Terminal::Orientation)d_pos;
|
||||
ori = ori_d;
|
||||
return(true);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
class ElementPerso : public ElementFixe {
|
||||
public:
|
||||
ElementPerso(QString &, QGraphicsItem * = 0, Diagram * = 0, int * = NULL);
|
||||
virtual int nbBornes() const;
|
||||
virtual int nbTerminals() const;
|
||||
virtual void paint(QPainter *, const QStyleOptionGraphicsItem *);
|
||||
inline QString typeId() { return(nomfichier); }
|
||||
inline QString fichier() { return(nomfichier); }
|
||||
@@ -24,12 +24,12 @@
|
||||
bool parseCercle(QDomElement &, QPainter &);
|
||||
bool parseArc(QDomElement &, QPainter &);
|
||||
bool parsePolygone(QDomElement &, QPainter &);
|
||||
bool parseBorne(QDomElement &, Diagram *);
|
||||
bool parseTerminal(QDomElement &, Diagram *);
|
||||
void setQPainterAntiAliasing(QPainter &, bool);
|
||||
bool attributeIsAnInteger(QDomElement &, QString, int * = NULL);
|
||||
bool attributeIsAReal(QDomElement &, QString, double * = NULL);
|
||||
bool validOrientationAttribute(QDomElement &);
|
||||
void setPainterStyle(QDomElement &, QPainter &);
|
||||
int nb_bornes;
|
||||
int nb_terminals;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -10,7 +10,7 @@ INCLUDEPATH += .
|
||||
# Input
|
||||
HEADERS += aboutqet.h \
|
||||
borderinset.h \
|
||||
borne.h \
|
||||
terminal.h \
|
||||
conducteur.h \
|
||||
element.h \
|
||||
elementfixe.h \
|
||||
@@ -22,7 +22,7 @@ HEADERS += aboutqet.h \
|
||||
diagramview.h
|
||||
SOURCES += aboutqet.cpp \
|
||||
borderinset.cpp \
|
||||
borne.cpp \
|
||||
terminal.cpp \
|
||||
conducteur.cpp \
|
||||
element.cpp \
|
||||
elementfixe.cpp \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "borne.h"
|
||||
#include "terminal.h"
|
||||
#include "diagram.h"
|
||||
#include "element.h"
|
||||
#include "conducteur.h"
|
||||
@@ -8,21 +8,21 @@
|
||||
@param pf position du point d'amarrage pour un conducteur
|
||||
@param o orientation de la borne : Qt::Horizontal ou Qt::Vertical
|
||||
*/
|
||||
void Borne::initialise(QPointF pf, Borne::Orientation o) {
|
||||
void Terminal::initialise(QPointF pf, Terminal::Orientation o) {
|
||||
// definition du pount d'amarrage pour un conducteur
|
||||
amarrage_conducteur = pf;
|
||||
|
||||
// definition de l'orientation de la borne (par defaut : sud)
|
||||
if (o < Borne::Nord || o > Borne::Ouest) sens = Borne::Sud;
|
||||
// definition de l'orientation de la terminal (par defaut : sud)
|
||||
if (o < Terminal::Nord || o > Terminal::Ouest) sens = Terminal::Sud;
|
||||
else sens = o;
|
||||
|
||||
// calcul de la position du point d'amarrage a l'element
|
||||
amarrage_elmt = amarrage_conducteur;
|
||||
switch(sens) {
|
||||
case Borne::Nord : amarrage_elmt += QPointF(0, TAILLE_BORNE); break;
|
||||
case Borne::Est : amarrage_elmt += QPointF(-TAILLE_BORNE, 0); break;
|
||||
case Borne::Ouest : amarrage_elmt += QPointF(TAILLE_BORNE, 0); break;
|
||||
case Borne::Sud :
|
||||
case Terminal::Nord : amarrage_elmt += QPointF(0, TAILLE_BORNE); break;
|
||||
case Terminal::Est : amarrage_elmt += QPointF(-TAILLE_BORNE, 0); break;
|
||||
case Terminal::Ouest : amarrage_elmt += QPointF(TAILLE_BORNE, 0); break;
|
||||
case Terminal::Sud :
|
||||
default : amarrage_elmt += QPointF(0, -TAILLE_BORNE);
|
||||
}
|
||||
|
||||
@@ -30,12 +30,12 @@ void Borne::initialise(QPointF pf, Borne::Orientation o) {
|
||||
|
||||
// QRectF null
|
||||
br = new QRectF();
|
||||
borne_precedente = NULL;
|
||||
terminal_precedente = NULL;
|
||||
// divers
|
||||
setAcceptsHoverEvents(true);
|
||||
setAcceptedMouseButtons(Qt::LeftButton);
|
||||
hovered = false;
|
||||
setToolTip("Borne");
|
||||
setToolTip("Terminal");
|
||||
couleur_neutre = QColor(Qt::blue);
|
||||
couleur_autorise = QColor(Qt::darkGreen);
|
||||
couleur_prudence = QColor("#ff8000");
|
||||
@@ -46,8 +46,8 @@ void Borne::initialise(QPointF pf, Borne::Orientation o) {
|
||||
/**
|
||||
Constructeur par defaut
|
||||
*/
|
||||
Borne::Borne() : QGraphicsItem(0, 0) {
|
||||
initialise(QPointF(0.0, 0.0), Borne::Sud);
|
||||
Terminal::Terminal() : QGraphicsItem(0, 0) {
|
||||
initialise(QPointF(0.0, 0.0), Terminal::Sud);
|
||||
diagram_scene = 0;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ Borne::Borne() : QGraphicsItem(0, 0) {
|
||||
@param e Element auquel cette borne appartient
|
||||
@param s Scene sur laquelle figure cette borne
|
||||
*/
|
||||
Borne::Borne(QPointF pf, Borne::Orientation o, Element *e, Diagram *s) : QGraphicsItem(e, s) {
|
||||
Terminal::Terminal(QPointF pf, Terminal::Orientation o, Element *e, Diagram *s) : QGraphicsItem(e, s) {
|
||||
initialise(pf, o);
|
||||
diagram_scene = s;
|
||||
}
|
||||
@@ -71,14 +71,14 @@ Borne::Borne(QPointF pf, Borne::Orientation o, Element *e, Diagram *s) : QGraphi
|
||||
@param e Element auquel cette borne appartient
|
||||
@param s Scene sur laquelle figure cette borne
|
||||
*/
|
||||
Borne::Borne(qreal pf_x, qreal pf_y, Borne::Orientation o, Element *e, Diagram *s) : QGraphicsItem(e, s) {
|
||||
Terminal::Terminal(qreal pf_x, qreal pf_y, Terminal::Orientation o, Element *e, Diagram *s) : QGraphicsItem(e, s) {
|
||||
initialise(QPointF(pf_x, pf_y), o);
|
||||
}
|
||||
|
||||
/**
|
||||
Destructeur
|
||||
*/
|
||||
Borne::~Borne() {
|
||||
Terminal::~Terminal() {
|
||||
delete br;
|
||||
}
|
||||
|
||||
@@ -87,21 +87,21 @@ Borne::~Borne() {
|
||||
est bien un Element, cette fonction renvoie l'orientation par rapport a
|
||||
la scene de la borne, en tenant compte du fait que l'element ait pu etre
|
||||
pivote. Sinon elle renvoie son sens normal.
|
||||
@return L'orientation actuelle de la Borne.
|
||||
@return L'orientation actuelle de la Terminal.
|
||||
*/
|
||||
Borne::Orientation Borne::orientation() const {
|
||||
Terminal::Orientation Terminal::orientation() const {
|
||||
//true pour une orientation verticale, false pour une orientation horizontale
|
||||
if (Element *elt = qgraphicsitem_cast<Element *>(parentItem())) {
|
||||
// orientations actuelle et par defaut de l'element
|
||||
Borne::Orientation ori_cur = elt -> orientation();
|
||||
Borne::Orientation ori_def = elt -> defaultOrientation();
|
||||
Terminal::Orientation ori_cur = elt -> orientation();
|
||||
Terminal::Orientation ori_def = elt -> defaultOrientation();
|
||||
if (ori_cur == ori_def) return(sens);
|
||||
else {
|
||||
// calcul l'angle de rotation implique par l'orientation de l'element parent
|
||||
// angle de rotation de la borne sur la scene, divise par 90
|
||||
int angle = ori_cur - ori_def + sens;
|
||||
while (angle >= 4) angle -= 4;
|
||||
return((Borne::Orientation)angle);
|
||||
return((Terminal::Orientation)angle);
|
||||
}
|
||||
} else return(sens);
|
||||
}
|
||||
@@ -110,20 +110,20 @@ Borne::Orientation Borne::orientation() const {
|
||||
Attribue un conducteur a la borne
|
||||
@param f Le conducteur a rattacher a cette borne
|
||||
*/
|
||||
bool Borne::addConducteur(Conducteur *f) {
|
||||
bool Terminal::addConducteur(Conducteur *f) {
|
||||
// pointeur 0 refuse
|
||||
if (!f) return(false);
|
||||
|
||||
// une seule des deux bornes du conducteur doit etre this
|
||||
Q_ASSERT_X((f -> borne1 == this ^ f -> borne2 == this), "Borne::addConducteur", "Le conducteur devrait etre relie exactement une fois a la borne en cours");
|
||||
Q_ASSERT_X((f -> terminal1 == this ^ f -> terminal2 == this), "Terminal::addConducteur", "Le conducteur devrait etre relie exactement une fois a la terminal en cours");
|
||||
|
||||
// determine l'autre borne a laquelle cette borne va etre relie grace au conducteur
|
||||
Borne *autre_borne = (f -> borne1 == this) ? f -> borne2 : f -> borne1;
|
||||
Terminal *autre_terminal = (f -> terminal1 == this) ? f -> terminal2 : f -> terminal1;
|
||||
|
||||
// verifie que la borne n'est pas deja reliee avec l'autre borne
|
||||
bool deja_liees = false;
|
||||
foreach (Conducteur* conducteur, liste_conducteurs) {
|
||||
if (conducteur -> borne1 == autre_borne || conducteur -> borne2 == autre_borne) deja_liees = true;
|
||||
if (conducteur -> terminal1 == autre_terminal || conducteur -> terminal2 == autre_terminal) deja_liees = true;
|
||||
}
|
||||
|
||||
// si les deux bornes sont deja reliees, on refuse d'ajouter le conducteur
|
||||
@@ -134,7 +134,7 @@ bool Borne::addConducteur(Conducteur *f) {
|
||||
return(true);
|
||||
}
|
||||
|
||||
void Borne::removeConducteur(Conducteur *f) {
|
||||
void Terminal::removeConducteur(Conducteur *f) {
|
||||
int index = liste_conducteurs.indexOf(f);
|
||||
if (index == -1) return;
|
||||
liste_conducteurs.removeAt(index);
|
||||
@@ -146,7 +146,7 @@ void Borne::removeConducteur(Conducteur *f) {
|
||||
@param options Les options de dessin
|
||||
@param widget Le widget sur lequel on dessine
|
||||
*/
|
||||
void Borne::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) {
|
||||
void Terminal::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) {
|
||||
p -> save();
|
||||
|
||||
//annulation des renderhints
|
||||
@@ -179,7 +179,7 @@ void Borne::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) {
|
||||
/**
|
||||
@return Le rectangle (en precision flottante) delimitant la borne et ses alentours.
|
||||
*/
|
||||
QRectF Borne::boundingRect() const {
|
||||
QRectF Terminal::boundingRect() const {
|
||||
if (br -> isNull()) {
|
||||
qreal afx = amarrage_conducteur.x();
|
||||
qreal afy = amarrage_conducteur.y();
|
||||
@@ -198,7 +198,7 @@ QRectF Borne::boundingRect() const {
|
||||
/**
|
||||
Gere l'entree de la souris sur la zone de la Borne.
|
||||
*/
|
||||
void Borne::hoverEnterEvent(QGraphicsSceneHoverEvent *) {
|
||||
void Terminal::hoverEnterEvent(QGraphicsSceneHoverEvent *) {
|
||||
hovered = true;
|
||||
update();
|
||||
}
|
||||
@@ -206,13 +206,13 @@ void Borne::hoverEnterEvent(QGraphicsSceneHoverEvent *) {
|
||||
/**
|
||||
Gere les mouvements de la souris sur la zone de la Borne.
|
||||
*/
|
||||
void Borne::hoverMoveEvent(QGraphicsSceneHoverEvent *) {
|
||||
void Terminal::hoverMoveEvent(QGraphicsSceneHoverEvent *) {
|
||||
}
|
||||
|
||||
/**
|
||||
Gere le fait que la souris sorte de la zone de la Borne.
|
||||
*/
|
||||
void Borne::hoverLeaveEvent(QGraphicsSceneHoverEvent *) {
|
||||
void Terminal::hoverLeaveEvent(QGraphicsSceneHoverEvent *) {
|
||||
hovered = false;
|
||||
update();
|
||||
}
|
||||
@@ -221,7 +221,7 @@ void Borne::hoverLeaveEvent(QGraphicsSceneHoverEvent *) {
|
||||
Gere le fait qu'on enfonce un bouton de la souris sur la Borne.
|
||||
@param e L'evenement souris correspondant
|
||||
*/
|
||||
void Borne::mousePressEvent(QGraphicsSceneMouseEvent *e) {
|
||||
void Terminal::mousePressEvent(QGraphicsSceneMouseEvent *e) {
|
||||
if (Diagram *s = qobject_cast<Diagram *>(scene())) {
|
||||
s -> setDepart(mapToScene(QPointF(amarrage_conducteur)));
|
||||
s -> setArrivee(e -> scenePos());
|
||||
@@ -234,16 +234,16 @@ void Borne::mousePressEvent(QGraphicsSceneMouseEvent *e) {
|
||||
Gere le fait qu'on bouge la souris sur la Borne.
|
||||
@param e L'evenement souris correspondant
|
||||
*/
|
||||
void Borne::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
||||
void Terminal::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
||||
// pendant la pose d'un conducteur, on adopte un autre curseur
|
||||
setCursor(Qt::CrossCursor);
|
||||
|
||||
// d'un mouvement a l'autre, il faut retirer l'effet hover de la borne precedente
|
||||
if (borne_precedente != NULL) {
|
||||
if (borne_precedente == this) hovered = true;
|
||||
else borne_precedente -> hovered = false;
|
||||
borne_precedente -> couleur_hovered = borne_precedente -> couleur_neutre;
|
||||
borne_precedente -> update();
|
||||
if (terminal_precedente != NULL) {
|
||||
if (terminal_precedente == this) hovered = true;
|
||||
else terminal_precedente -> hovered = false;
|
||||
terminal_precedente -> couleur_hovered = terminal_precedente -> couleur_neutre;
|
||||
terminal_precedente -> update();
|
||||
}
|
||||
|
||||
// si la scene est un Diagram, on actualise le poseur de conducteur
|
||||
@@ -258,14 +258,14 @@ void Borne::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
||||
= la liste ne peut etre vide
|
||||
= on prend le deuxieme element de la liste
|
||||
*/
|
||||
Q_ASSERT_X(!(qgis.isEmpty()), "Borne::mouseMoveEvent", "La liste d'items ne devrait pas etre vide");
|
||||
Q_ASSERT_X(!(qgis.isEmpty()), "Terminal::mouseMoveEvent", "La liste d'items ne devrait pas etre vide");
|
||||
|
||||
// s'il y a autre chose que le poseur de conducteur dans la liste
|
||||
if (qgis.size() > 1) {
|
||||
// on prend le deuxieme element de la liste
|
||||
QGraphicsItem *qgi = qgis.at(1);
|
||||
// si le qgi est une borne...
|
||||
if (Borne *p = qgraphicsitem_cast<Borne *>(qgi)) {
|
||||
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) {
|
||||
// ...on lui applique l'effet hover approprie
|
||||
if (p == this) {
|
||||
// effet si l'on hover sur la borne de depart
|
||||
@@ -280,7 +280,7 @@ void Borne::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
||||
// verifie que cette borne n'est pas deja reliee a l'autre borne
|
||||
bool deja_reliee = false;
|
||||
foreach (Conducteur *f, liste_conducteurs) {
|
||||
if (f -> borne1 == p || f -> borne2 == p) {
|
||||
if (f -> terminal1 == p || f -> terminal2 == p) {
|
||||
deja_reliee = true;
|
||||
break;
|
||||
}
|
||||
@@ -291,7 +291,7 @@ void Borne::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
||||
// effet si on peut poser le conducteur
|
||||
p -> couleur_hovered = p -> couleur_autorise;
|
||||
}
|
||||
borne_precedente = p;
|
||||
terminal_precedente = p;
|
||||
p -> hovered = true;
|
||||
p -> update();
|
||||
}
|
||||
@@ -302,9 +302,9 @@ void Borne::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
||||
Gere le fait qu'on relache la souris sur la Borne.
|
||||
@param e L'evenement souris correspondant
|
||||
*/
|
||||
void Borne::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
|
||||
void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
|
||||
setCursor(Qt::ArrowCursor);
|
||||
borne_precedente = NULL;
|
||||
terminal_precedente = NULL;
|
||||
couleur_hovered = couleur_neutre;
|
||||
// verifie que la scene est bien un Diagram
|
||||
if (Diagram *s = qobject_cast<Diagram *>(scene())) {
|
||||
@@ -315,7 +315,7 @@ void Borne::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
|
||||
// s'il n'y a rien, on arrete la
|
||||
if (!qgi) return;
|
||||
// idem si l'element obtenu n'est pas une borne
|
||||
Borne *p = qgraphicsitem_cast<Borne *>(qgi);
|
||||
Terminal *p = qgraphicsitem_cast<Terminal *>(qgi);
|
||||
if (!p) return;
|
||||
// on remet la couleur de hover a sa valeur par defaut
|
||||
p -> couleur_hovered = p -> couleur_neutre;
|
||||
@@ -325,17 +325,17 @@ void Borne::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
|
||||
bool cia = ((Element *)parentItem()) -> connexionsInternesAcceptees();
|
||||
if (!cia) foreach(QGraphicsItem *item, parentItem() -> children()) if (item == p) return;
|
||||
// derniere verification : verifier que cette borne n'est pas deja reliee a l'autre borne
|
||||
foreach (Conducteur *f, liste_conducteurs) if (f -> borne1 == p || f -> borne2 == p) return;
|
||||
foreach (Conducteur *f, liste_conducteurs) if (f -> terminal1 == p || f -> terminal2 == p) return;
|
||||
// autrement, on pose un conducteur
|
||||
new Conducteur(this, (Borne *)qgi, 0, scene());
|
||||
new Conducteur(this, (Terminal *)qgi, 0, scene());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Met a jour l'eventuel conducteur relie a la Borne.
|
||||
Met a jour l'eventuel conducteur relie a la Terminal.
|
||||
@param newpos Position de l'element parent a prendre en compte
|
||||
*/
|
||||
void Borne::updateConducteur(QPointF newpos) {
|
||||
void Terminal::updateConducteur(QPointF newpos) {
|
||||
if (!scene() || !parentItem()) return;
|
||||
foreach (Conducteur *conducteur, liste_conducteurs) {
|
||||
if (conducteur -> isDestroyed()) continue;
|
||||
@@ -352,7 +352,7 @@ void Borne::updateConducteur(QPointF newpos) {
|
||||
/**
|
||||
@return La liste des conducteurs lies a cette borne
|
||||
*/
|
||||
QList<Conducteur *> Borne::conducteurs() const {
|
||||
QList<Conducteur *> Terminal::conducteurs() const {
|
||||
return(liste_conducteurs);
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@ QList<Conducteur *> Borne::conducteurs() const {
|
||||
@param doc Le Document XML a utiliser pour creer l'element XML
|
||||
@return un QDomElement representant cette borne
|
||||
*/
|
||||
QDomElement Borne::toXml(QDomDocument &doc) const {
|
||||
QDomElement Terminal::toXml(QDomDocument &doc) const {
|
||||
QDomElement qdo = doc.createElement("borne");
|
||||
qdo.setAttribute("x", amarrage_elmt.x());
|
||||
qdo.setAttribute("y", amarrage_elmt.y());
|
||||
@@ -374,32 +374,32 @@ QDomElement Borne::toXml(QDomDocument &doc) const {
|
||||
@param e Le QDomElement a analyser
|
||||
@return true si le QDomElement passe en parametre est une borne, false sinon
|
||||
*/
|
||||
bool Borne::valideXml(QDomElement &borne) {
|
||||
bool Terminal::valideXml(QDomElement &terminal) {
|
||||
// verifie le nom du tag
|
||||
if (borne.tagName() != "borne") return(false);
|
||||
if (terminal.tagName() != "borne") return(false);
|
||||
|
||||
// verifie la presence des attributs minimaux
|
||||
if (!borne.hasAttribute("x")) return(false);
|
||||
if (!borne.hasAttribute("y")) return(false);
|
||||
if (!borne.hasAttribute("orientation")) return(false);
|
||||
if (!terminal.hasAttribute("x")) return(false);
|
||||
if (!terminal.hasAttribute("y")) return(false);
|
||||
if (!terminal.hasAttribute("orientation")) return(false);
|
||||
|
||||
bool conv_ok;
|
||||
// parse l'abscisse
|
||||
borne.attribute("x").toDouble(&conv_ok);
|
||||
terminal.attribute("x").toDouble(&conv_ok);
|
||||
if (!conv_ok) return(false);
|
||||
|
||||
// parse l'ordonnee
|
||||
borne.attribute("y").toDouble(&conv_ok);
|
||||
terminal.attribute("y").toDouble(&conv_ok);
|
||||
if (!conv_ok) return(false);
|
||||
|
||||
// parse l'id
|
||||
borne.attribute("id").toInt(&conv_ok);
|
||||
terminal.attribute("id").toInt(&conv_ok);
|
||||
if (!conv_ok) return(false);
|
||||
|
||||
// parse l'orientation
|
||||
int borne_or = borne.attribute("orientation").toInt(&conv_ok);
|
||||
int terminal_or = terminal.attribute("orientation").toInt(&conv_ok);
|
||||
if (!conv_ok) return(false);
|
||||
if (borne_or != Borne::Nord && borne_or != Borne::Sud && borne_or != Borne::Est && borne_or != Borne::Ouest) return(false);
|
||||
if (terminal_or != Terminal::Nord && terminal_or != Terminal::Sud && terminal_or != Terminal::Est && terminal_or != Terminal::Ouest) return(false);
|
||||
|
||||
// a ce stade, la borne est syntaxiquement correcte
|
||||
return(true);
|
||||
@@ -410,11 +410,11 @@ bool Borne::valideXml(QDomElement &borne) {
|
||||
@param e Le QDomElement a analyser
|
||||
@return true si la borne "se reconnait" (memes coordonnes, meme orientation), false sinon
|
||||
*/
|
||||
bool Borne::fromXml(QDomElement &borne) {
|
||||
bool Terminal::fromXml(QDomElement &terminal) {
|
||||
return (
|
||||
borne.attribute("x").toDouble() == amarrage_elmt.x() &&\
|
||||
borne.attribute("y").toDouble() == amarrage_elmt.y() &&\
|
||||
borne.attribute("orientation").toInt() == sens
|
||||
terminal.attribute("x").toDouble() == amarrage_elmt.x() &&\
|
||||
terminal.attribute("y").toDouble() == amarrage_elmt.y() &&\
|
||||
terminal.attribute("orientation").toInt() == sens
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
Classe modelisant la « borne » d'un appareil, c'est-a-dire un
|
||||
branchement possible pour un Conducteur.
|
||||
*/
|
||||
class Borne : public QGraphicsItem {
|
||||
class Terminal : public QGraphicsItem {
|
||||
public:
|
||||
// enum definissant l'orientation de la borne
|
||||
enum Orientation {Nord, Est, Sud, Ouest};
|
||||
@@ -20,12 +20,12 @@
|
||||
virtual int type() const { return Type; }
|
||||
|
||||
// constructeurs
|
||||
Borne();
|
||||
Borne(QPointF, Borne::Orientation, Element * = 0, Diagram * = 0);
|
||||
Borne(qreal, qreal, Borne::Orientation, Element * = 0, Diagram * = 0);
|
||||
Terminal();
|
||||
Terminal(QPointF, Terminal::Orientation, Element * = 0, Diagram * = 0);
|
||||
Terminal(qreal, qreal, Terminal::Orientation, Element * = 0, Diagram * = 0);
|
||||
|
||||
// destructeur
|
||||
~Borne();
|
||||
~Terminal();
|
||||
|
||||
// implementation des methodes virtuelles pures de QGraphicsItem
|
||||
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
// methodes de lecture
|
||||
QList<Conducteur *> conducteurs() const;
|
||||
Borne::Orientation orientation() const;
|
||||
Terminal::Orientation orientation() const;
|
||||
inline QPointF amarrageConducteur() const { return(mapToScene(amarrage_conducteur)); }
|
||||
void updateConducteur(QPointF = QPointF());
|
||||
|
||||
@@ -63,15 +63,15 @@
|
||||
QPointF amarrage_conducteur;
|
||||
QPointF amarrage_elmt;
|
||||
// orientation de la borne
|
||||
Borne::Orientation sens;
|
||||
Terminal::Orientation sens;
|
||||
// liste des conducteurs lies a cette borne
|
||||
QList<Conducteur *> liste_conducteurs;
|
||||
// pointeur vers un rectangle correspondant au bounding rect ; permet de ne calculer le bounding rect qu'une seule fois ; le pointeur c'est parce que le compilo exige une methode const
|
||||
QRectF *br;
|
||||
Borne *borne_precedente;
|
||||
Terminal *terminal_precedente;
|
||||
bool hovered;
|
||||
// methode initialisant les differents membres de la borne
|
||||
void initialise(QPointF, Borne::Orientation);
|
||||
void initialise(QPointF, Terminal::Orientation);
|
||||
// differentes couleurs utilisables pour l'effet "hover"
|
||||
QColor couleur_hovered;
|
||||
QColor couleur_neutre;
|
||||
Reference in New Issue
Block a user