Classe "Conducteur" renommee en "Conducer"

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@46 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavierqet
2007-01-29 20:32:38 +00:00
parent 628494ae80
commit 9d14e21360
10 changed files with 133 additions and 133 deletions

View File

@@ -1,10 +1,10 @@
#include <QtDebug> #include <QtDebug>
#include "conducteur.h" #include "conducer.h"
#include "element.h" #include "element.h"
bool Conducteur::pen_and_brush_initialized = false; bool Conducer::pen_and_brush_initialized = false;
QPen Conducteur::conducer_pen = QPen(); QPen Conducer::conducer_pen = QPen();
QBrush Conducteur::conducer_brush = QBrush(); QBrush Conducer::conducer_brush = QBrush();
/** /**
Constructeur Constructeur
@@ -13,13 +13,13 @@ QBrush Conducteur::conducer_brush = QBrush();
@param parent Element parent du conducteur (0 par defaut) @param parent Element parent du conducteur (0 par defaut)
@param scene QGraphicsScene auquelle appartient le conducteur @param scene QGraphicsScene auquelle appartient le conducteur
*/ */
Conducteur::Conducteur(Terminal *p1, Terminal* p2, Element *parent, QGraphicsScene *scene) : QGraphicsPathItem(parent, scene) { Conducer::Conducer(Terminal *p1, Terminal* p2, Element *parent, QGraphicsScene *scene) : QGraphicsPathItem(parent, scene) {
// bornes que le conducteur relie // bornes que le conducteur relie
terminal1 = p1; terminal1 = p1;
terminal2 = p2; terminal2 = p2;
// ajout du conducteur a la liste de conducteurs de chacune des deux bornes // ajout du conducteur a la liste de conducteurs de chacune des deux bornes
bool ajout_p1 = terminal1 -> addConducteur(this); bool ajout_p1 = terminal1 -> addConducer(this);
bool ajout_p2 = terminal2 -> addConducteur(this); bool ajout_p2 = terminal2 -> addConducer(this);
// en cas d'echec de l'ajout (conducteur deja existant notamment) // en cas d'echec de l'ajout (conducteur deja existant notamment)
if (!ajout_p1 || !ajout_p2) return; if (!ajout_p1 || !ajout_p2) return;
destroyed = false; destroyed = false;
@@ -36,7 +36,7 @@ Conducteur::Conducteur(Terminal *p1, Terminal* p2, Element *parent, QGraphicsSce
pen_and_brush_initialized = true; pen_and_brush_initialized = true;
} }
// calcul du rendu du conducteur // calcul du rendu du conducteur
priv_calculeConducteur(terminal1 -> amarrageConducteur(), terminal1 -> orientation(), terminal2 -> amarrageConducteur(), terminal2 -> orientation()); priv_calculeConducer(terminal1 -> amarrageConducer(), terminal1 -> orientation(), terminal2 -> amarrageConducer(), terminal2 -> orientation());
setFlags(QGraphicsItem::ItemIsSelectable); setFlags(QGraphicsItem::ItemIsSelectable);
} }
@@ -44,15 +44,15 @@ Conducteur::Conducteur(Terminal *p1, Terminal* p2, Element *parent, QGraphicsSce
Met a jour la representation graphique du conducteur. Met a jour la representation graphique du conducteur.
@param rect Rectangle a mettre a jour @param rect Rectangle a mettre a jour
*/ */
void Conducteur::update(const QRectF &rect) { void Conducer::update(const QRectF &rect) {
// utilise soit la fonction priv_modifieConducteur soit la fonction priv_calculeConducteur // utilise soit la fonction priv_modifieConducteur soit la fonction priv_calculeConducteur
void (Conducteur::* fonction_update) (const QPointF &, Terminal::Orientation, const QPointF &, Terminal::Orientation); void (Conducer::* fonction_update) (const QPointF &, Terminal::Orientation, const QPointF &, Terminal::Orientation);
fonction_update = (points.count() && modified_path) ? &Conducteur::priv_modifieConducteur : &Conducteur::priv_calculeConducteur; fonction_update = (points.count() && modified_path) ? &Conducer::priv_modifieConducer : &Conducer::priv_calculeConducer;
// appelle la bonne fonction pour calculer l'aspect du conducteur // appelle la bonne fonction pour calculer l'aspect du conducteur
(this ->* fonction_update)( (this ->* fonction_update)(
terminal1 -> amarrageConducteur(), terminal1 -> orientation(), terminal1 -> amarrageConducer(), terminal1 -> orientation(),
terminal2 -> amarrageConducteur(), terminal2 -> orientation() terminal2 -> amarrageConducer(), terminal2 -> orientation()
); );
QGraphicsPathItem::update(rect); QGraphicsPathItem::update(rect);
} }
@@ -64,29 +64,29 @@ void Conducteur::update(const QRectF &rect) {
@param b Borne @param b Borne
@param pos position de la borne b @param pos position de la borne b
*/ */
void Conducteur::updateWithNewPos(const QRectF &rect, const Terminal *b, const QPointF &newpos) { void Conducer::updateWithNewPos(const QRectF &rect, const Terminal *b, const QPointF &newpos) {
QPointF p1, p2; QPointF p1, p2;
if (b == terminal1) { if (b == terminal1) {
p1 = newpos; p1 = newpos;
p2 = terminal2 -> amarrageConducteur(); p2 = terminal2 -> amarrageConducer();
} else if (b == terminal2) { } else if (b == terminal2) {
p1 = terminal1 -> amarrageConducteur(); p1 = terminal1 -> amarrageConducer();
p2 = newpos; p2 = newpos;
} else { } else {
p1 = terminal1 -> amarrageConducteur(); p1 = terminal1 -> amarrageConducer();
p2 = terminal2 -> amarrageConducteur(); p2 = terminal2 -> amarrageConducer();
} }
if (points.count() && modified_path) if (points.count() && modified_path)
priv_modifieConducteur(p1, terminal1 -> orientation(), p2, terminal2 -> orientation()); priv_modifieConducer(p1, terminal1 -> orientation(), p2, terminal2 -> orientation());
else else
priv_calculeConducteur(p1, terminal1 -> orientation(), p2, terminal2 -> orientation()); priv_calculeConducer(p1, terminal1 -> orientation(), p2, terminal2 -> orientation());
QGraphicsPathItem::update(rect); QGraphicsPathItem::update(rect);
} }
/** /**
Genere le QPainterPath a partir de la liste des points Genere le QPainterPath a partir de la liste des points
*/ */
void Conducteur::pointsToPath() { void Conducer::pointsToPath() {
QPainterPath path; QPainterPath path;
bool moveto_done = false; bool moveto_done = false;
foreach(QPointF point, points) { foreach(QPointF point, points) {
@@ -105,12 +105,12 @@ void Conducteur::pointsToPath() {
@param p2 Coordonnees du point d'amarrage de la borne 2 @param p2 Coordonnees du point d'amarrage de la borne 2
@param o2 Orientation de la borne 2 @param o2 Orientation de la borne 2
*/ */
void Conducteur::priv_modifieConducteur(const QPointF &p1, Terminal::Orientation, const QPointF &p2, Terminal::Orientation) { void Conducer::priv_modifieConducer(const QPointF &p1, Terminal::Orientation, const QPointF &p2, Terminal::Orientation) {
Q_ASSERT_X(points.count() > 1, "priv_modifieConducteur", "pas de points a modifier"); Q_ASSERT_X(points.count() > 1, "priv_modifieConducer", "pas de points a modifier");
// recupere les dernieres coordonnees connues des bornes // recupere les dernieres coordonnees connues des bornes
QPointF old_p1 = mapFromScene(terminal1 -> amarrageConducteur()); QPointF old_p1 = mapFromScene(terminal1 -> amarrageConducer());
QPointF old_p2 = mapFromScene(terminal2 -> amarrageConducteur()); QPointF old_p2 = mapFromScene(terminal2 -> amarrageConducer());
// recupere les coordonnees fournies des bornes // recupere les coordonnees fournies des bornes
QPointF new_p1 = mapFromScene(p1); QPointF new_p1 = mapFromScene(p1);
@@ -151,7 +151,7 @@ void Conducteur::priv_modifieConducteur(const QPointF &p1, Terminal::Orientation
@param p2 Coordonnees du point d'amarrage de la borne 2 @param p2 Coordonnees du point d'amarrage de la borne 2
@param o2 Orientation de la borne 2 @param o2 Orientation de la borne 2
*/ */
void Conducteur::priv_calculeConducteur(const QPointF &p1, Terminal::Orientation o1, const QPointF &p2, Terminal::Orientation o2) { void Conducer::priv_calculeConducer(const QPointF &p1, Terminal::Orientation o1, const QPointF &p2, Terminal::Orientation o2) {
QPointF sp1, sp2, depart, newp1, newp2, arrivee, depart0, arrivee0; QPointF sp1, sp2, depart, newp1, newp2, arrivee, depart0, arrivee0;
Terminal::Orientation ori_depart, ori_arrivee; Terminal::Orientation ori_depart, ori_arrivee;
points.clear(); points.clear();
@@ -240,7 +240,7 @@ void Conducteur::priv_calculeConducteur(const QPointF &p1, Terminal::Orientation
@param ext_size la taille de la prolongation @param ext_size la taille de la prolongation
@return le point correspondant a la borne apres prolongation @return le point correspondant a la borne apres prolongation
*/ */
QPointF Conducteur::extendTerminal(const QPointF &terminal, Terminal::Orientation terminal_orientation, qreal ext_size) { QPointF Conducer::extendTerminal(const QPointF &terminal, Terminal::Orientation terminal_orientation, qreal ext_size) {
QPointF extended_terminal; QPointF extended_terminal;
switch(terminal_orientation) { switch(terminal_orientation) {
case Terminal::Nord: case Terminal::Nord:
@@ -266,7 +266,7 @@ QPointF Conducteur::extendTerminal(const QPointF &terminal, Terminal::Orientatio
@param qsogi Les options de style pour le conducteur @param qsogi Les options de style pour le conducteur
@param qw Le QWidget sur lequel on dessine @param qw Le QWidget sur lequel on dessine
*/ */
void Conducteur::paint(QPainter *qp, const QStyleOptionGraphicsItem */*qsogi*/, QWidget */*qw*/) { void Conducer::paint(QPainter *qp, const QStyleOptionGraphicsItem */*qsogi*/, QWidget */*qw*/) {
qp -> save(); qp -> save();
qp -> setRenderHint(QPainter::Antialiasing, false); qp -> setRenderHint(QPainter::Antialiasing, false);
@@ -300,7 +300,7 @@ void Conducteur::paint(QPainter *qp, const QStyleOptionGraphicsItem */*qsogi*/,
@param b La seconde orientation de Borne @param b La seconde orientation de Borne
@return Un booleen a true si les deux orientations de bornes sont sur le meme axe @return Un booleen a true si les deux orientations de bornes sont sur le meme axe
*/ */
bool Conducteur::surLeMemeAxe(Terminal::Orientation a, Terminal::Orientation b) { bool Conducer::surLeMemeAxe(Terminal::Orientation a, Terminal::Orientation b) {
if ((a == Terminal::Nord || a == Terminal::Sud) && (b == Terminal::Nord || b == Terminal::Sud)) return(true); 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 if ((a == Terminal::Est || a == Terminal::Ouest) && (b == Terminal::Est || b == Terminal::Ouest)) return(true);
else return(false); else return(false);
@@ -311,7 +311,7 @@ bool Conducteur::surLeMemeAxe(Terminal::Orientation a, Terminal::Orientation b)
@param a L'orientation de borne @param a L'orientation de borne
@return True si l'orientation de borne est horizontale, false sinon @return True si l'orientation de borne est horizontale, false sinon
*/ */
bool Conducteur::estHorizontale(Terminal::Orientation a) { bool Conducer::estHorizontale(Terminal::Orientation a) {
return(a == Terminal::Est || a == Terminal::Ouest); return(a == Terminal::Est || a == Terminal::Ouest);
} }
@@ -320,17 +320,17 @@ bool Conducteur::estHorizontale(Terminal::Orientation a) {
@param a L'orientation de borne @param a L'orientation de borne
@return True si l'orientation de borne est verticale, false sinon @return True si l'orientation de borne est verticale, false sinon
*/ */
bool Conducteur::estVerticale(Terminal::Orientation a) { bool Conducer::estVerticale(Terminal::Orientation a) {
return(a == Terminal::Nord || a == Terminal::Sud); return(a == Terminal::Nord || a == Terminal::Sud);
} }
/** /**
Methode de preparation a la destruction du conducteur ; le conducteur se detache de ses deux bornes Methode de preparation a la destruction du conducteur ; le conducteur se detache de ses deux bornes
*/ */
void Conducteur::destroy() { void Conducer::destroy() {
destroyed = true; destroyed = true;
terminal1 -> removeConducteur(this); terminal1 -> removeConducer(this);
terminal2 -> removeConducteur(this); terminal2 -> removeConducer(this);
} }
/** /**
@@ -338,7 +338,7 @@ void Conducteur::destroy() {
@param e Un element XML sense represente un Conducteur @param e Un element XML sense represente un Conducteur
@return true si l'element XML represente bien un Conducteur ; false sinon @return true si l'element XML represente bien un Conducteur ; false sinon
*/ */
bool Conducteur::valideXml(QDomElement &e){ bool Conducer::valideXml(QDomElement &e){
// verifie le nom du tag // verifie le nom du tag
if (e.tagName() != "conducteur") return(false); if (e.tagName() != "conducteur") return(false);
@@ -361,7 +361,7 @@ bool Conducteur::valideXml(QDomElement &e){
Gere les clics sur le conducteur. Gere les clics sur le conducteur.
@param e L'evenement decrivant le clic. @param e L'evenement decrivant le clic.
*/ */
void Conducteur::mousePressEvent(QGraphicsSceneMouseEvent *e) { void Conducer::mousePressEvent(QGraphicsSceneMouseEvent *e) {
// clic gauche // clic gauche
if (e -> buttons() & Qt::LeftButton) { if (e -> buttons() & Qt::LeftButton) {
press_point = mapFromScene(e -> pos()); press_point = mapFromScene(e -> pos());
@@ -395,7 +395,7 @@ void Conducteur::mousePressEvent(QGraphicsSceneMouseEvent *e) {
-mettre le flag "trajet modifie" a true -mettre le flag "trajet modifie" a true
-gerer les contraintes -gerer les contraintes
*/ */
void Conducteur::mouseMoveEvent(QGraphicsSceneMouseEvent *e) { void Conducer::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
// clic gauche // clic gauche
if (e -> buttons() & Qt::LeftButton) { if (e -> buttons() & Qt::LeftButton) {
if (moving_point) { if (moving_point) {
@@ -504,7 +504,7 @@ void Conducteur::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
Gere les relachements de boutons de souris sur le conducteur Gere les relachements de boutons de souris sur le conducteur
@param e L'evenement decrivant le lacher de bouton. @param e L'evenement decrivant le lacher de bouton.
*/ */
void Conducteur::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) { void Conducer::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
// clic gauche // clic gauche
if (e -> buttons() & Qt::LeftButton) { if (e -> buttons() & Qt::LeftButton) {
moving_point = false; moving_point = false;
@@ -515,7 +515,7 @@ void Conducteur::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
/** /**
@return Le rectangle delimitant l'espace de dessin du conducteur @return Le rectangle delimitant l'espace de dessin du conducteur
*/ */
QRectF Conducteur::boundingRect() const { QRectF Conducer::boundingRect() const {
QRectF retour = QGraphicsPathItem::boundingRect(); QRectF retour = QGraphicsPathItem::boundingRect();
retour.adjust(-5.0, -5.0, 5.0, 5.0); retour.adjust(-5.0, -5.0, 5.0, 5.0);
return(retour); return(retour);
@@ -524,7 +524,7 @@ QRectF Conducteur::boundingRect() const {
/** /**
@return La forme / zone "cliquable" du conducteur @return La forme / zone "cliquable" du conducteur
*/ */
QPainterPath Conducteur::shape() const { QPainterPath Conducer::shape() const {
QPainterPath area; QPainterPath area;
QPointF previous_point; QPointF previous_point;
QPointF *point1, *point2; QPointF *point1, *point2;
@@ -564,7 +564,7 @@ QPainterPath Conducteur::shape() const {
/** /**
Met à jour deux listes de reels. Met à jour deux listes de reels.
*/ */
void Conducteur::updatePoints() { void Conducer::updatePoints() {
int s = points.size(); int s = points.size();
moves_x.clear(); moves_x.clear();
moves_y.clear(); moves_y.clear();
@@ -578,7 +578,7 @@ void Conducteur::updatePoints() {
orig_dist_2_terms_y = b2.y() - b1.y(); orig_dist_2_terms_y = b2.y() - b1.y();
} }
qreal Conducteur::conducer_bound(qreal tobound, qreal bound1, qreal bound2) { qreal Conducer::conducer_bound(qreal tobound, qreal bound1, qreal bound2) {
qreal space = 5.0; qreal space = 5.0;
if (bound1 < bound2) { if (bound1 < bound2) {
return(qBound(bound1 + space, tobound, bound2 - space)); return(qBound(bound1 + space, tobound, bound2 - space));
@@ -587,7 +587,7 @@ qreal Conducteur::conducer_bound(qreal tobound, qreal bound1, qreal bound2) {
} }
} }
qreal Conducteur::conducer_bound(qreal tobound, qreal bound, bool positive) { qreal Conducer::conducer_bound(qreal tobound, qreal bound, bool positive) {
qreal space = 5.0; qreal space = 5.0;
return(positive ? qMax(tobound, bound + space) : qMin(tobound, bound - space)); return(positive ? qMax(tobound, bound + space) : qMin(tobound, bound - space));
} }

View File

@@ -6,12 +6,12 @@
/** /**
Cette classe represente un conducteur. Un conducteur relie deux bornes d'element. Cette classe represente un conducteur. Un conducteur relie deux bornes d'element.
*/ */
class Conducteur : public QGraphicsPathItem { class Conducer : public QGraphicsPathItem {
public: public:
enum { Type = UserType + 1001 }; enum { Type = UserType + 1001 };
virtual int type() const { return Type; } virtual int type() const { return Type; }
Conducteur(Terminal *, Terminal *, Element * = 0, QGraphicsScene * = 0); Conducer(Terminal *, Terminal *, Element * = 0, QGraphicsScene * = 0);
//virtual ~Conducteur(); //virtual ~Conducer();
void destroy(); void destroy();
bool isDestroyed() const { return(destroyed); } bool isDestroyed() const { return(destroyed); }
@@ -51,8 +51,8 @@
void pointsToPath(); void pointsToPath();
void updatePoints(); void updatePoints();
void priv_calculeConducteur(const QPointF &, Terminal::Orientation, const QPointF &, Terminal::Orientation); void priv_calculeConducer(const QPointF &, Terminal::Orientation, const QPointF &, Terminal::Orientation);
void priv_modifieConducteur(const QPointF &, Terminal::Orientation, const QPointF &, Terminal::Orientation); void priv_modifieConducer(const QPointF &, Terminal::Orientation, const QPointF &, Terminal::Orientation);
static QPointF extendTerminal(const QPointF &, Terminal::Orientation, qreal = 12.0); static QPointF extendTerminal(const QPointF &, Terminal::Orientation, qreal = 12.0);
static bool surLeMemeAxe(Terminal::Orientation, Terminal::Orientation); static bool surLeMemeAxe(Terminal::Orientation, Terminal::Orientation);
static bool estHorizontale(Terminal::Orientation a); static bool estHorizontale(Terminal::Orientation a);

View File

@@ -1,5 +1,5 @@
#include <math.h> #include <math.h>
#include "conducteur.h" #include "conducer.h"
#include "elementperso.h" #include "elementperso.h"
#include "diagram.h" #include "diagram.h"
@@ -9,14 +9,14 @@
*/ */
Diagram::Diagram(QObject *parent) : QGraphicsScene(parent) { Diagram::Diagram(QObject *parent) : QGraphicsScene(parent) {
setBackgroundBrush(Qt::white); setBackgroundBrush(Qt::white);
poseur_de_conducteur = new QGraphicsLineItem(0, 0); poseur_de_conducer = new QGraphicsLineItem(0, 0);
poseur_de_conducteur -> setZValue(1000000); poseur_de_conducer -> setZValue(1000000);
QPen t; QPen t;
t.setColor(Qt::black); t.setColor(Qt::black);
t.setWidthF(1.5); t.setWidthF(1.5);
t.setStyle(Qt::DashLine); t.setStyle(Qt::DashLine);
poseur_de_conducteur -> setPen(t); poseur_de_conducer -> setPen(t);
poseur_de_conducteur -> setLine(QLineF(QPointF(0.0, 0.0), QPointF(0.0, 0.0))); poseur_de_conducer -> setLine(QLineF(QPointF(0.0, 0.0), QPointF(0.0, 0.0)));
doit_dessiner_grille = true; doit_dessiner_grille = true;
connect(this, SIGNAL(changed(const QList<QRectF> &)), this, SLOT(slot_checkSelectionChange())); connect(this, SIGNAL(changed(const QList<QRectF> &)), this, SLOT(slot_checkSelectionChange()));
} }
@@ -158,7 +158,7 @@ QDomDocument Diagram::toXml(bool diagram) {
// creation de deux listes : une qui contient les elements, une qui contient les conducteurs // creation de deux listes : une qui contient les elements, une qui contient les conducteurs
QList<Element *> liste_elements; QList<Element *> liste_elements;
QList<Conducteur *> liste_conducteurs; QList<Conducer *> liste_conducers;
// Determine les elements a « XMLiser » // Determine les elements a « XMLiser »
@@ -166,11 +166,11 @@ QDomDocument Diagram::toXml(bool diagram) {
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi)) { if (Element *elmt = qgraphicsitem_cast<Element *>(qgi)) {
if (diagram) liste_elements << elmt; if (diagram) liste_elements << elmt;
else if (elmt -> isSelected()) liste_elements << elmt; else if (elmt -> isSelected()) liste_elements << elmt;
} else if (Conducteur *f = qgraphicsitem_cast<Conducteur *>(qgi)) { } else if (Conducer *f = qgraphicsitem_cast<Conducer *>(qgi)) {
if (diagram) liste_conducteurs << f; if (diagram) liste_conducers << f;
// lorsqu'on n'exporte pas tout le diagram, il faut retirer les conducteurs non selectionnes // 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 // et pour l'instant, les conducteurs non selectionnes sont les conducteurs dont un des elements n'est pas relie
else if (f -> terminal1 -> parentItem() -> isSelected() && f -> terminal2 -> parentItem() -> isSelected()) liste_conducteurs << f; else if (f -> terminal1 -> parentItem() -> isSelected() && f -> terminal2 -> parentItem() -> isSelected()) liste_conducers << f;
} }
} }
@@ -219,15 +219,15 @@ QDomDocument Diagram::toXml(bool diagram) {
racine.appendChild(elements); racine.appendChild(elements);
// enregistrement des conducteurs // enregistrement des conducteurs
if (liste_conducteurs.isEmpty()) return(document); if (liste_conducers.isEmpty()) return(document);
QDomElement conducteurs = document.createElement("conducteurs"); QDomElement conducers = document.createElement("conducteurs");
foreach(Conducteur *f, liste_conducteurs) { foreach(Conducer *f, liste_conducers) {
QDomElement conducteur = document.createElement("conducteur"); QDomElement conducer = document.createElement("conducteur");
conducteur.setAttribute("borne1", table_adr_id.value(f -> terminal1)); conducer.setAttribute("borne1", table_adr_id.value(f -> terminal1));
conducteur.setAttribute("borne2", table_adr_id.value(f -> terminal2)); conducer.setAttribute("borne2", table_adr_id.value(f -> terminal2));
conducteurs.appendChild(conducteur); conducers.appendChild(conducer);
} }
racine.appendChild(conducteurs); racine.appendChild(conducers);
// on retourne le document XML ainsi genere // on retourne le document XML ainsi genere
return(document); return(document);
@@ -312,13 +312,13 @@ bool Diagram::fromXml(QDomDocument &document, QPointF position, bool consider_in
// chargement de tous les Conducteurs du fichier XML // chargement de tous les Conducteurs du fichier XML
for (QDomNode node = racine.firstChild() ; !node.isNull() ; node = node.nextSibling()) { for (QDomNode node = racine.firstChild() ; !node.isNull() ; node = node.nextSibling()) {
// on s'interesse a l'element XML "conducteurs" (= groupe de conducteurs) // on s'interesse a l'element XML "conducteurs" (= groupe de conducteurs)
QDomElement conducteurs = node.toElement(); QDomElement conducers = node.toElement();
if(conducteurs.isNull() || conducteurs.tagName() != "conducteurs") continue; if(conducers.isNull() || conducers.tagName() != "conducteurs") continue;
// parcours des enfants de l'element XML "conducteurs" // parcours des enfants de l'element XML "conducteurs"
for (QDomNode n = conducteurs.firstChild() ; !n.isNull() ; n = n.nextSibling()) { for (QDomNode n = conducers.firstChild() ; !n.isNull() ; n = n.nextSibling()) {
// on s'interesse a l'element XML "element" (elements eux-memes) // on s'interesse a l'element XML "element" (elements eux-memes)
QDomElement f = n.toElement(); QDomElement f = n.toElement();
if (f.isNull() || !Conducteur::valideXml(f)) continue; if (f.isNull() || !Conducer::valideXml(f)) continue;
// verifie que les bornes que le conducteur relie sont connues // verifie que les bornes que le conducteur relie sont connues
int id_p1 = f.attribute("borne1").toInt(); int id_p1 = f.attribute("borne1").toInt();
int id_p2 = f.attribute("borne2").toInt(); int id_p2 = f.attribute("borne2").toInt();
@@ -327,12 +327,12 @@ bool Diagram::fromXml(QDomDocument &document, QPointF position, bool consider_in
Terminal *p1 = table_adr_id.value(id_p1); Terminal *p1 = table_adr_id.value(id_p1);
Terminal *p2 = table_adr_id.value(id_p2); Terminal *p2 = table_adr_id.value(id_p2);
if (p1 != p2) { if (p1 != p2) {
bool peut_poser_conducteur = true; bool peut_poser_conducer = true;
bool cia = ((Element *)p2 -> parentItem()) -> connexionsInternesAcceptees(); bool cia = ((Element *)p2 -> parentItem()) -> connexionsInternesAcceptees();
if (!cia) foreach(QGraphicsItem *item, p2 -> parentItem() -> children()) if (item == p1) peut_poser_conducteur = false; if (!cia) foreach(QGraphicsItem *item, p2 -> parentItem() -> children()) if (item == p1) peut_poser_conducer = false;
if (peut_poser_conducteur) new Conducteur(table_adr_id.value(id_p1), table_adr_id.value(id_p2), 0, this); if (peut_poser_conducer) new Conducer(table_adr_id.value(id_p1), table_adr_id.value(id_p2), 0, this);
} }
} else qDebug() << "Le chargement du conducteur" << id_p1 << id_p2 << "a echoue"; } else qDebug() << "Le chargement du conducer" << id_p1 << id_p2 << "a echoue";
} }
} }
return(true); return(true);

View File

@@ -14,15 +14,15 @@
public: public:
Diagram(QObject * = 0); Diagram(QObject * = 0);
void drawBackground(QPainter *, const QRectF &); void drawBackground(QPainter *, const QRectF &);
inline void poseConducteur(bool pf) { inline void poseConducer(bool pf) {
if (pf) { if (pf) {
if (!poseur_de_conducteur -> scene()) addItem(poseur_de_conducteur); if (!poseur_de_conducer -> scene()) addItem(poseur_de_conducer);
} else { } else {
if (poseur_de_conducteur -> scene()) removeItem(poseur_de_conducteur); if (poseur_de_conducer -> scene()) removeItem(poseur_de_conducer);
} }
} }
inline void setDepart (QPointF d) { poseur_de_conducteur -> setLine(QLineF(d, poseur_de_conducteur -> line().p2())); } inline void setDepart (QPointF d) { poseur_de_conducer -> setLine(QLineF(d, poseur_de_conducer -> line().p2())); }
inline void setArrivee(QPointF a) { poseur_de_conducteur -> setLine(QLineF(poseur_de_conducteur -> line().p1(), a)); } inline void setArrivee(QPointF a) { poseur_de_conducer -> setLine(QLineF(poseur_de_conducer -> line().p1(), a)); }
QImage toImage(int = -1, int = -1, bool = true); QImage toImage(int = -1, int = -1, bool = true);
QSize imageSize() const; QSize imageSize() const;
QDomDocument toXml(bool = true); QDomDocument toXml(bool = true);
@@ -33,7 +33,7 @@
QRectF border() const; QRectF border() const;
private: private:
QGraphicsLineItem *poseur_de_conducteur; QGraphicsLineItem *poseur_de_conducer;
bool doit_dessiner_grille; bool doit_dessiner_grille;
Element *elementFromXml(QDomElement &, QHash<int, Terminal *> &); Element *elementFromXml(QDomElement &, QHash<int, Terminal *> &);

View File

@@ -84,14 +84,14 @@ void DiagramView::selectInvert() {
void DiagramView::supprimer() { void DiagramView::supprimer() {
QList<QGraphicsItem *> garbage_elmt; QList<QGraphicsItem *> garbage_elmt;
QList<QGraphicsItem *> garbage_conducteurs; QList<QGraphicsItem *> garbage_conducers;
// creation de deux listes : une pour les conducteurs, une pour les elements // creation de deux listes : une pour les conducteurs, une pour les elements
foreach (QGraphicsItem *qgi, scene -> selectedItems()) { foreach (QGraphicsItem *qgi, scene -> selectedItems()) {
// pour chaque qgi selectionne, il s'agit soit d'un element soit d'un conducteur // pour chaque qgi selectionne, il s'agit soit d'un element soit d'un conducteur
if (qgraphicsitem_cast<Conducteur *>(qgi)) { if (qgraphicsitem_cast<Conducer *>(qgi)) {
// s'il s'agit d'un conducteur, on le met dans la liste des conducteurs // s'il s'agit d'un conducteur, on le met dans la liste des conducteurs
if (!garbage_conducteurs.contains(qgi)) garbage_conducteurs.append(qgi); if (!garbage_conducers.contains(qgi)) garbage_conducers.append(qgi);
} else if (qgraphicsitem_cast<Element *>(qgi)) { } else if (qgraphicsitem_cast<Element *>(qgi)) {
// s'il s'agit d'un element, on veille a enlever ses conducteurs // s'il s'agit d'un element, on veille a enlever ses conducteurs
if (!garbage_elmt.contains(qgi)) garbage_elmt.append(qgi); if (!garbage_elmt.contains(qgi)) garbage_elmt.append(qgi);
@@ -100,8 +100,8 @@ void DiagramView::supprimer() {
// si cet enfant est une borne // si cet enfant est une borne
if (Terminal *p = qgraphicsitem_cast<Terminal *>(child)) { if (Terminal *p = qgraphicsitem_cast<Terminal *>(child)) {
// alors chaque conducteur de la borne est recense // alors chaque conducteur de la borne est recense
foreach (Conducteur *f, p -> conducteurs()) { foreach (Conducer *f, p -> conducers()) {
if (!garbage_conducteurs.contains(f)) garbage_conducteurs.append(f); if (!garbage_conducers.contains(f)) garbage_conducers.append(f);
} }
} }
} }
@@ -110,8 +110,8 @@ void DiagramView::supprimer() {
scene -> clearSelection(); scene -> clearSelection();
// "destroying" the wires, removing them from the scene and stocking them into the « garbage » // "destroying" the wires, removing them from the scene and stocking them into the « garbage »
foreach (QGraphicsItem *qgi, garbage_conducteurs) { foreach (QGraphicsItem *qgi, garbage_conducers) {
if (Conducteur *f = qgraphicsitem_cast<Conducteur *>(qgi)) { if (Conducer *f = qgraphicsitem_cast<Conducer *>(qgi)) {
f -> destroy(); f -> destroy();
scene -> removeItem(f); scene -> removeItem(f);
throwToGarbage(f); throwToGarbage(f);

View File

@@ -3,7 +3,7 @@
#include <QtGui> #include <QtGui>
class Diagram; class Diagram;
#include "element.h" #include "element.h"
#include "conducteur.h" #include "conducer.h"
#define TAILLE_GRILLE 10 #define TAILLE_GRILLE 10
/** /**
Classe representant graphiquement un schema electrique Classe representant graphiquement un schema electrique

View File

@@ -107,11 +107,11 @@ QPixmap Element::pixmap() {
QVariant Element::itemChange(GraphicsItemChange change, const QVariant &value) { QVariant Element::itemChange(GraphicsItemChange change, const QVariant &value) {
if (change == QGraphicsItem::ItemPositionChange) { if (change == QGraphicsItem::ItemPositionChange) {
foreach(QGraphicsItem *qgi, children()) { foreach(QGraphicsItem *qgi, children()) {
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) p -> updateConducteur(value.toPointF()); if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) p -> updateConducer(value.toPointF());
} }
} else if (change == QGraphicsItem::ItemSelectedChange) { } else if (change == QGraphicsItem::ItemSelectedChange) {
foreach(QGraphicsItem *qgi, children()) { foreach(QGraphicsItem *qgi, children()) {
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) p -> updateConducteur(); if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) p -> updateConducer();
} }
} }
return(QGraphicsItem::itemChange(change, value)); return(QGraphicsItem::itemChange(change, value));
@@ -126,7 +126,7 @@ bool Element::setOrientation(Terminal::Orientation o) {
ori = o; ori = o;
update(); update();
foreach(QGraphicsItem *qgi, children()) { foreach(QGraphicsItem *qgi, children()) {
if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) p -> updateConducteur(); if (Terminal *p = qgraphicsitem_cast<Terminal *>(qgi)) p -> updateConducer();
} }
return(true); return(true);
} }

View File

@@ -11,7 +11,7 @@ INCLUDEPATH += .
HEADERS += aboutqet.h \ HEADERS += aboutqet.h \
borderinset.h \ borderinset.h \
terminal.h \ terminal.h \
conducteur.h \ conducer.h \
element.h \ element.h \
elementfixe.h \ elementfixe.h \
elementperso.h \ elementperso.h \
@@ -23,7 +23,7 @@ HEADERS += aboutqet.h \
SOURCES += aboutqet.cpp \ SOURCES += aboutqet.cpp \
borderinset.cpp \ borderinset.cpp \
terminal.cpp \ terminal.cpp \
conducteur.cpp \ conducer.cpp \
element.cpp \ element.cpp \
elementfixe.cpp \ elementfixe.cpp \
elementperso.cpp \ elementperso.cpp \

View File

@@ -1,7 +1,7 @@
#include "terminal.h" #include "terminal.h"
#include "diagram.h" #include "diagram.h"
#include "element.h" #include "element.h"
#include "conducteur.h" #include "conducer.h"
/** /**
Fonction privee pour initialiser la borne. Fonction privee pour initialiser la borne.
@@ -10,14 +10,14 @@
*/ */
void Terminal::initialise(QPointF pf, Terminal::Orientation o) { void Terminal::initialise(QPointF pf, Terminal::Orientation o) {
// definition du pount d'amarrage pour un conducteur // definition du pount d'amarrage pour un conducteur
amarrage_conducteur = pf; amarrage_conducer = pf;
// definition de l'orientation de la terminal (par defaut : sud) // definition de l'orientation de la terminal (par defaut : sud)
if (o < Terminal::Nord || o > Terminal::Ouest) sens = Terminal::Sud; if (o < Terminal::Nord || o > Terminal::Ouest) sens = Terminal::Sud;
else sens = o; else sens = o;
// calcul de la position du point d'amarrage a l'element // calcul de la position du point d'amarrage a l'element
amarrage_elmt = amarrage_conducteur; amarrage_elmt = amarrage_conducer;
switch(sens) { switch(sens) {
case Terminal::Nord : amarrage_elmt += QPointF(0, TAILLE_BORNE); break; case Terminal::Nord : amarrage_elmt += QPointF(0, TAILLE_BORNE); break;
case Terminal::Est : amarrage_elmt += QPointF(-TAILLE_BORNE, 0); break; case Terminal::Est : amarrage_elmt += QPointF(-TAILLE_BORNE, 0); break;
@@ -107,37 +107,37 @@ Terminal::Orientation Terminal::orientation() const {
} }
/** /**
Attribue un conducteur a la borne Attribue un conducer a la borne
@param f Le conducteur a rattacher a cette borne @param f Le conducteur a rattacher a cette borne
*/ */
bool Terminal::addConducteur(Conducteur *f) { bool Terminal::addConducer(Conducer *f) {
// pointeur 0 refuse // pointeur 0 refuse
if (!f) return(false); if (!f) return(false);
// une seule des deux bornes du conducteur doit etre this // une seule des deux bornes du conducteur doit etre this
Q_ASSERT_X((f -> terminal1 == this ^ f -> terminal2 == this), "Terminal::addConducteur", "Le conducteur devrait etre relie exactement une fois a la terminal en cours"); Q_ASSERT_X((f -> terminal1 == this ^ f -> terminal2 == this), "Terminal::addConducer", "Le conducer 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 // determine l'autre borne a laquelle cette borne va etre relie grace au conducteur
Terminal *autre_terminal = (f -> terminal1 == this) ? f -> terminal2 : f -> terminal1; Terminal *autre_terminal = (f -> terminal1 == this) ? f -> terminal2 : f -> terminal1;
// verifie que la borne n'est pas deja reliee avec l'autre borne // verifie que la borne n'est pas deja reliee avec l'autre borne
bool deja_liees = false; bool deja_liees = false;
foreach (Conducteur* conducteur, liste_conducteurs) { foreach (Conducer* conducer, liste_conducers) {
if (conducteur -> terminal1 == autre_terminal || conducteur -> terminal2 == autre_terminal) deja_liees = true; if (conducer -> terminal1 == autre_terminal || conducer -> terminal2 == autre_terminal) deja_liees = true;
} }
// si les deux bornes sont deja reliees, on refuse d'ajouter le conducteur // si les deux bornes sont deja reliees, on refuse d'ajouter le conducteur
if (deja_liees) return(false); if (deja_liees) return(false);
// sinon on ajoute le conducteur // sinon on ajoute le conducteur
liste_conducteurs.append(f); liste_conducers.append(f);
return(true); return(true);
} }
void Terminal::removeConducteur(Conducteur *f) { void Terminal::removeConducer(Conducer *f) {
int index = liste_conducteurs.indexOf(f); int index = liste_conducers.indexOf(f);
if (index == -1) return; if (index == -1) return;
liste_conducteurs.removeAt(index); liste_conducers.removeAt(index);
} }
/** /**
@@ -155,7 +155,7 @@ void Terminal::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) {
p -> setRenderHint(QPainter::SmoothPixmapTransform, false); p -> setRenderHint(QPainter::SmoothPixmapTransform, false);
// on travaille avec les coordonnees de l'element parent // on travaille avec les coordonnees de l'element parent
QPointF f = mapFromParent(amarrage_conducteur); QPointF f = mapFromParent(amarrage_conducer);
QPointF e = mapFromParent(amarrage_elmt); QPointF e = mapFromParent(amarrage_elmt);
QPen t; QPen t;
@@ -181,12 +181,12 @@ void Terminal::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) {
*/ */
QRectF Terminal::boundingRect() const { QRectF Terminal::boundingRect() const {
if (br -> isNull()) { if (br -> isNull()) {
qreal afx = amarrage_conducteur.x(); qreal afx = amarrage_conducer.x();
qreal afy = amarrage_conducteur.y(); qreal afy = amarrage_conducer.y();
qreal aex = amarrage_elmt.x(); qreal aex = amarrage_elmt.x();
qreal aey = amarrage_elmt.y(); qreal aey = amarrage_elmt.y();
QPointF origine; QPointF origine;
origine = (afx <= aex && afy <= aey ? amarrage_conducteur : amarrage_elmt); origine = (afx <= aex && afy <= aey ? amarrage_conducer : amarrage_elmt);
origine += QPointF(-3.0, -3.0); origine += QPointF(-3.0, -3.0);
qreal w = qAbs((int)(afx - aex)) + 7; qreal w = qAbs((int)(afx - aex)) + 7;
qreal h = qAbs((int)(afy - aey)) + 7; qreal h = qAbs((int)(afy - aey)) + 7;
@@ -223,9 +223,9 @@ void Terminal::hoverLeaveEvent(QGraphicsSceneHoverEvent *) {
*/ */
void Terminal::mousePressEvent(QGraphicsSceneMouseEvent *e) { void Terminal::mousePressEvent(QGraphicsSceneMouseEvent *e) {
if (Diagram *s = qobject_cast<Diagram *>(scene())) { if (Diagram *s = qobject_cast<Diagram *>(scene())) {
s -> setDepart(mapToScene(QPointF(amarrage_conducteur))); s -> setDepart(mapToScene(QPointF(amarrage_conducer)));
s -> setArrivee(e -> scenePos()); s -> setArrivee(e -> scenePos());
s -> poseConducteur(true); s -> poseConducer(true);
setCursor(Qt::CrossCursor); setCursor(Qt::CrossCursor);
} }
} }
@@ -253,7 +253,7 @@ void Terminal::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
QList<QGraphicsItem *> qgis = scene() -> items(e -> scenePos()); QList<QGraphicsItem *> qgis = scene() -> items(e -> scenePos());
/* le qgi le plus haut /* le qgi le plus haut
= le poseur de conducteur = le poseur de conducer
= le premier element de la liste = le premier element de la liste
= la liste ne peut etre vide = la liste ne peut etre vide
= on prend le deuxieme element de la liste = on prend le deuxieme element de la liste
@@ -275,11 +275,11 @@ void Terminal::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
if (((Element *)parentItem()) -> connexionsInternesAcceptees()) if (((Element *)parentItem()) -> connexionsInternesAcceptees())
p -> couleur_hovered = p -> couleur_autorise; p -> couleur_hovered = p -> couleur_autorise;
else p -> couleur_hovered = p -> couleur_interdit; else p -> couleur_hovered = p -> couleur_interdit;
} else if (p -> nbConducteurs()) { } else if (p -> nbConducers()) {
// si la borne a deja un conducteur // si la borne a deja un conducteur
// verifie que cette borne n'est pas deja reliee a l'autre borne // verifie que cette borne n'est pas deja reliee a l'autre borne
bool deja_reliee = false; bool deja_reliee = false;
foreach (Conducteur *f, liste_conducteurs) { foreach (Conducer *f, liste_conducers) {
if (f -> terminal1 == p || f -> terminal2 == p) { if (f -> terminal1 == p || f -> terminal2 == p) {
deja_reliee = true; deja_reliee = true;
break; break;
@@ -309,7 +309,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
// verifie que la scene est bien un Diagram // verifie que la scene est bien un Diagram
if (Diagram *s = qobject_cast<Diagram *>(scene())) { if (Diagram *s = qobject_cast<Diagram *>(scene())) {
// on arrete de dessiner l'apercu du conducteur // on arrete de dessiner l'apercu du conducteur
s -> poseConducteur(false); s -> poseConducer(false);
// on recupere l'element sous le pointeur lors du MouseReleaseEvent // on recupere l'element sous le pointeur lors du MouseReleaseEvent
QGraphicsItem *qgi = s -> itemAt(e -> scenePos()); QGraphicsItem *qgi = s -> itemAt(e -> scenePos());
// s'il n'y a rien, on arrete la // s'il n'y a rien, on arrete la
@@ -325,9 +325,9 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
bool cia = ((Element *)parentItem()) -> connexionsInternesAcceptees(); bool cia = ((Element *)parentItem()) -> connexionsInternesAcceptees();
if (!cia) foreach(QGraphicsItem *item, parentItem() -> children()) if (item == p) return; 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 // derniere verification : verifier que cette borne n'est pas deja reliee a l'autre borne
foreach (Conducteur *f, liste_conducteurs) if (f -> terminal1 == p || f -> terminal2 == p) return; foreach (Conducer *f, liste_conducers) if (f -> terminal1 == p || f -> terminal2 == p) return;
// autrement, on pose un conducteur // autrement, on pose un conducteur
new Conducteur(this, (Terminal *)qgi, 0, scene()); new Conducer(this, (Terminal *)qgi, 0, scene());
} }
} }
@@ -335,16 +335,16 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
Met a jour l'eventuel conducteur relie a la Terminal. Met a jour l'eventuel conducteur relie a la Terminal.
@param newpos Position de l'element parent a prendre en compte @param newpos Position de l'element parent a prendre en compte
*/ */
void Terminal::updateConducteur(QPointF newpos) { void Terminal::updateConducer(QPointF newpos) {
if (!scene() || !parentItem()) return; if (!scene() || !parentItem()) return;
foreach (Conducteur *conducteur, liste_conducteurs) { foreach (Conducer *conducer, liste_conducers) {
if (conducteur -> isDestroyed()) continue; if (conducer -> isDestroyed()) continue;
if (newpos == QPointF()) conducteur -> update(QRectF()); if (newpos == QPointF()) conducer -> update(QRectF());
else { else {
// determine la translation subie par l'element parent // determine la translation subie par l'element parent
QPointF translation = newpos - parentItem() -> pos(); QPointF translation = newpos - parentItem() -> pos();
// rafraichit le conducteur en tenant compte de la translation // rafraichit le conducteur en tenant compte de la translation
conducteur -> updateWithNewPos(QRectF(), this, amarrageConducteur() + translation); conducer -> updateWithNewPos(QRectF(), this, amarrageConducer() + translation);
} }
} }
} }
@@ -352,8 +352,8 @@ void Terminal::updateConducteur(QPointF newpos) {
/** /**
@return La liste des conducteurs lies a cette borne @return La liste des conducteurs lies a cette borne
*/ */
QList<Conducteur *> Terminal::conducteurs() const { QList<Conducer *> Terminal::conducers() const {
return(liste_conducteurs); return(liste_conducers);
} }
/** /**

View File

@@ -3,7 +3,7 @@
#define TAILLE_BORNE 4 #define TAILLE_BORNE 4
#include <QtGui> #include <QtGui>
#include <QtXml> #include <QtXml>
class Conducteur; class Conducer;
class Element; class Element;
class Diagram; class Diagram;
/** /**
@@ -32,15 +32,15 @@
QRectF boundingRect() const; QRectF boundingRect() const;
// methodes de manipulation des conducteurs lies a cette borne // methodes de manipulation des conducteurs lies a cette borne
bool addConducteur(Conducteur *); bool addConducer(Conducer *);
void removeConducteur(Conducteur *); void removeConducer(Conducer *);
inline int nbConducteurs() const { return(liste_conducteurs.size()); } inline int nbConducers() const { return(liste_conducers.size()); }
// methodes de lecture // methodes de lecture
QList<Conducteur *> conducteurs() const; QList<Conducer *> conducers() const;
Terminal::Orientation orientation() const; Terminal::Orientation orientation() const;
inline QPointF amarrageConducteur() const { return(mapToScene(amarrage_conducteur)); } inline QPointF amarrageConducer() const { return(mapToScene(amarrage_conducer)); }
void updateConducteur(QPointF = QPointF()); void updateConducer(QPointF = QPointF());
// methodes relatives a l'import/export au format XML // methodes relatives a l'import/export au format XML
static bool valideXml(QDomElement &); static bool valideXml(QDomElement &);
@@ -60,12 +60,12 @@
// pointeur vers la QGraphicsScene de type Diagram (evite quelques casts en interne) // pointeur vers la QGraphicsScene de type Diagram (evite quelques casts en interne)
Diagram *diagram_scene; Diagram *diagram_scene;
// coordonnees des points d'amarrage // coordonnees des points d'amarrage
QPointF amarrage_conducteur; QPointF amarrage_conducer;
QPointF amarrage_elmt; QPointF amarrage_elmt;
// orientation de la borne // orientation de la borne
Terminal::Orientation sens; Terminal::Orientation sens;
// liste des conducteurs lies a cette borne // liste des conducers lies a cette borne
QList<Conducteur *> liste_conducteurs; QList<Conducer *> liste_conducers;
// 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 // 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; QRectF *br;
Terminal *terminal_precedente; Terminal *terminal_precedente;