mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-29 23:40:51 +01:00
Implementation des methodes et attributs relatifs aux conducteurs unifilaires
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@150 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
69
conducer.h
69
conducer.h
@@ -6,6 +6,26 @@
|
||||
#include "diagramtextitem.h"
|
||||
class ConducerSegment;
|
||||
class Element;
|
||||
/**
|
||||
Cette classe represente les proprietes specifiques a un conducteur unifilaire
|
||||
*/
|
||||
class SingleLineProperties {
|
||||
public:
|
||||
SingleLineProperties();
|
||||
virtual ~SingleLineProperties();
|
||||
void setPhasesCount(int);
|
||||
unsigned short int phasesCount();
|
||||
void draw(QPainter *, QET::ConducerSegmentType, const QRectF &);
|
||||
void toXml(QDomDocument &, QDomElement &) const;
|
||||
void fromXml(QDomElement &);
|
||||
bool hasGround;
|
||||
bool hasNeutral;
|
||||
private:
|
||||
unsigned short int phases;
|
||||
void drawGround (QPainter *, QET::ConducerSegmentType, QPointF, qreal);
|
||||
void drawNeutral(QPainter *, QET::ConducerSegmentType, QPointF, qreal);
|
||||
};
|
||||
|
||||
/**
|
||||
Cette classe represente un conducteur. Un conducteur relie deux bornes d'element.
|
||||
*/
|
||||
@@ -27,24 +47,8 @@ class Conducer : public QGraphicsPathItem {
|
||||
Terminal *terminal1;
|
||||
///Deuxieme borne a laquelle le fil est rattache
|
||||
Terminal *terminal2;
|
||||
|
||||
private:
|
||||
/// booleen indiquant si le fil est encore valide
|
||||
bool destroyed;
|
||||
DiagramTextItem *text_item;
|
||||
ConducerSegment *segments;
|
||||
QPointF press_point;
|
||||
bool moving_point;
|
||||
bool moving_segment;
|
||||
int moved_point;
|
||||
qreal previous_z_value;
|
||||
ConducerSegment *moved_segment;
|
||||
bool modified_path;
|
||||
bool has_to_save_profile;
|
||||
ConducerProfile conducer_profile;
|
||||
static QPen conducer_pen;
|
||||
static QBrush conducer_brush;
|
||||
static bool pen_and_brush_initialized;
|
||||
/// caracteristiques des conducteurs unifilaires
|
||||
SingleLineProperties singleLineProperties;
|
||||
|
||||
// methodes
|
||||
public:
|
||||
@@ -64,6 +68,8 @@ class Conducer : public QGraphicsPathItem {
|
||||
QDomElement toXml(QDomDocument &, QHash<Terminal *, int> &) const;
|
||||
const QList<ConducerSegment *> segmentsList() const;
|
||||
void setProfile(const ConducerProfile &);
|
||||
void setSingleLine(bool);
|
||||
bool isSingleLine() const;
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent *);
|
||||
@@ -71,6 +77,33 @@ class Conducer : public QGraphicsPathItem {
|
||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *);
|
||||
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *);
|
||||
|
||||
private:
|
||||
/// booleen indiquant si le fil est encore valide
|
||||
bool destroyed;
|
||||
/// booleen indiquant le mode du conducteur : unifilaire ou non
|
||||
bool is_single_line;
|
||||
/// champ de texte editable pour les conducteurs non unifilaires
|
||||
DiagramTextItem *text_item;
|
||||
/// Segments composant le conducteur
|
||||
ConducerSegment *segments;
|
||||
/// Attributs lies aux manipulations a la souris
|
||||
QPointF press_point;
|
||||
bool moving_point;
|
||||
bool moving_segment;
|
||||
int moved_point;
|
||||
qreal previous_z_value;
|
||||
ConducerSegment *moved_segment;
|
||||
/// booleen indiquant si le conducteur a ete modifie manuellement par l'utilisateur
|
||||
bool modified_path;
|
||||
/// booleen indiquant s'il faut sauver le profil courant au plus tot
|
||||
bool has_to_save_profile;
|
||||
/// profil du conducteur : "photo" de ce a quoi le conducteur doit ressembler
|
||||
ConducerProfile conducer_profile;
|
||||
/// QPen et QBrush utilises pour dessiner les conducteurs
|
||||
static QPen conducer_pen;
|
||||
static QBrush conducer_brush;
|
||||
static bool pen_and_brush_initialized;
|
||||
|
||||
private:
|
||||
void segmentsToPath();
|
||||
void saveProfile(bool = true);
|
||||
|
||||
Reference in New Issue
Block a user