[qet] [2610] Update number of terminal, add new constructor and setNumber function.

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 2610
Author:   cfdev
Date:     2013-11-13 12:55:27 +0100 (Wed, 13 Nov 2013)
Log Message:
-----------
Update number of terminal, add new constructor and setNumber function.

Modified Paths:
--------------
    trunk/sources/terminal.cpp
    trunk/sources/terminal.h

Modified: trunk/sources/terminal.cpp
===================================================================
--- trunk/sources/terminal.cpp	2013-11-12 18:43:59 UTC (rev 2609)
+++ trunk/sources/terminal.cpp	2013-11-13 11:55:27 UTC (rev 2610)
@@ -71,12 +71,12 @@
 	@param e   Element auquel cette borne appartient
 	@param s   Scene sur laquelle figure cette borne
 */
-Terminal::Terminal(QPointF pf, QET::Orientation o, QString num, Element *e, Diagram *s) :
+Terminal::Terminal(QPointF pf, QET::Orientation o, Element *e, Diagram *s) :
 	QGraphicsItem(e, s),
 	parent_element_(e),
 	hovered_color_(Terminal::neutralColor)
 {
-	init(pf, o, num);
+	init(pf, o, "_");
 }
 
 /**
@@ -87,15 +87,31 @@
 	@param e    Element auquel cette borne appartient
 	@param s    Scene sur laquelle figure cette borne
 */
-Terminal::Terminal(qreal pf_x, qreal pf_y, QET::Orientation o, QString num, Element *e, Diagram *s) :
+Terminal::Terminal(qreal pf_x, qreal pf_y, QET::Orientation o, Element *e, Diagram *s) :
 	QGraphicsItem(e, s),
 	parent_element_(e),
 	hovered_color_(Terminal::neutralColor)
 {
-	init(QPointF(pf_x, pf_y), o, num);
+	init(QPointF(pf_x, pf_y), o, "_");
 }
 
 /**
+	initialise une borne
+	@param pf  position du point d'amarrage pour un conducteur
+	@param o   orientation de la borne : Qt::Horizontal ou Qt::Vertical
+	@param num number of terminal (ex 3 - 4 for NO)
+	@param e   Element auquel cette borne appartient
+	@param s   Scene sur laquelle figure cette borne
+*/
+Terminal::Terminal(QPointF pf, QET::Orientation o, QString num, Element *e, Diagram *s) :
+	QGraphicsItem(e, s),
+	parent_element_(e),
+	hovered_color_(Terminal::neutralColor)
+{
+	init(pf, o, num);
+}
+
+/**
 	Destructeur
 	La destruction de la borne entraine la destruction des conducteurs
 	associes.
@@ -128,7 +144,16 @@
 	} else return(ori_);
 }
 
+
 /**
+ * @brief Terminal::setNumber
+ * @param number
+ */
+void Terminal::setNumber(QString number) {
+	number_terminal_ = number;
+}
+
+/**
 	Attribue un conductor a la borne
 	@param f Le conducteur a rattacher a cette borne
 */
@@ -489,7 +514,7 @@
 		qFuzzyCompare(terminal.attribute("x").toDouble(), dock_elmt_.x()) &&
 		qFuzzyCompare(terminal.attribute("y").toDouble(), dock_elmt_.y()) &&
 		terminal.attribute("orientation").toInt() == ori_ &&
-		terminal.attribute("number").toInt() == number_terminal_
+		terminal.attribute("number") == number_terminal_
 	);
 }
 
@@ -506,3 +531,4 @@
 Element *Terminal::parentElement() const {
 	return(parent_element_);
 }
+

Modified: trunk/sources/terminal.h
===================================================================
--- trunk/sources/terminal.h	2013-11-12 18:43:59 UTC (rev 2609)
+++ trunk/sources/terminal.h	2013-11-13 11:55:27 UTC (rev 2610)
@@ -31,8 +31,9 @@
 	
 	// constructors, destructor
 	public:
+	Terminal(QPointF,      QET::Orientation, Element * = 0, Diagram * = 0);
+	Terminal(qreal, qreal, QET::Orientation, Element * = 0, Diagram * = 0);
 	Terminal(QPointF,      QET::Orientation, QString number, Element * = 0, Diagram * = 0);
-	Terminal(qreal, qreal, QET::Orientation, QString number, Element * = 0, Diagram * = 0);
 	virtual ~Terminal();
 	
 	private:
@@ -62,6 +63,7 @@
 	QET::Orientation orientation() const;
 	QPointF dockConductor() const;
 	QString number() const;
+	void setNumber(QString number);
 	void updateConductor();
 	bool isLinkedTo(Terminal *);
 	bool canBeLinkedTo(Terminal *);


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/