mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
Creation de la methode QET::correctAngle.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@813 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -434,3 +434,15 @@ QString QET::pointerString(void *ptr) {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param angle Un angle quelconque
|
||||||
|
@return l'angle passe en parametre, mais ramene entre -360.0 + 360.0 degres
|
||||||
|
*/
|
||||||
|
qreal QET::correctAngle(const qreal &angle) {
|
||||||
|
// ramene l'angle demande entre -360.0 et +360.0 degres
|
||||||
|
qreal corrected_angle = angle;
|
||||||
|
while (corrected_angle < 360.0) corrected_angle += 360.0;
|
||||||
|
while (corrected_angle > 360.0) corrected_angle -= 360.0;
|
||||||
|
return(corrected_angle);
|
||||||
|
}
|
||||||
|
|||||||
@@ -121,5 +121,6 @@ namespace QET {
|
|||||||
QString diagramAreaToString(const QET::DiagramArea &);
|
QString diagramAreaToString(const QET::DiagramArea &);
|
||||||
QET::DiagramArea diagramAreaFromString(const QString &);
|
QET::DiagramArea diagramAreaFromString(const QString &);
|
||||||
QString pointerString(void *);
|
QString pointerString(void *);
|
||||||
|
qreal correctAngle(const qreal &);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -199,9 +199,7 @@ void Terminal::paint(QPainter *p, const QStyleOptionGraphicsItem *options, QWidg
|
|||||||
// orientations actuelle et par defaut de l'element
|
// orientations actuelle et par defaut de l'element
|
||||||
QET::Orientation ori_cur = elt -> orientation().current();
|
QET::Orientation ori_cur = elt -> orientation().current();
|
||||||
QET::Orientation ori_def = elt -> orientation().defaultOrientation();
|
QET::Orientation ori_def = elt -> orientation().defaultOrientation();
|
||||||
applied_rotation = 90.0 * (ori_cur - ori_def);
|
applied_rotation = QET::correctAngle(90.0 * (ori_cur - ori_def));
|
||||||
while (applied_rotation < 360.0) applied_rotation += 360.0;
|
|
||||||
while (applied_rotation > 360.0) applied_rotation -= 360.0;
|
|
||||||
}
|
}
|
||||||
if (applied_rotation == 90.0) p -> translate(1.0, -1.0);
|
if (applied_rotation == 90.0) p -> translate(1.0, -1.0);
|
||||||
else if (applied_rotation == 180.0) p -> translate(-1.0, -1.0);
|
else if (applied_rotation == 180.0) p -> translate(-1.0, -1.0);
|
||||||
|
|||||||
Reference in New Issue
Block a user