From 29ddef00350fdebb0e0ce029f1c8e1f93db893be Mon Sep 17 00:00:00 2001 From: xavier Date: Sat, 18 Apr 2009 17:23:04 +0000 Subject: [PATCH] Modification des conditions definissant un trajet de conducteur comme etant incoherent. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@595 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/conductor.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/sources/conductor.cpp b/sources/conductor.cpp index d4cd0f183..1d350d5de 100644 --- a/sources/conductor.cpp +++ b/sources/conductor.cpp @@ -16,7 +16,6 @@ along with QElectroTech. If not, see . */ #include -#include #include "conductor.h" #include "conductorsegment.h" #include "conductorsegmentprofile.h" @@ -894,13 +893,15 @@ bool Conductor::fromXml(QDomElement &e) { QPointF t2 = terminal2 -> amarrageConductor(); qreal expected_width = t2.x() - t1.x(); qreal expected_height = t2.y() - t1.y(); - qreal precision = std::numeric_limits::epsilon(); + + // on considere que le trajet est incoherent a partir d'une unite de difference avec l'espacement entre les bornes if ( - expected_width > width + precision ||\ - expected_width < width - precision ||\ - expected_height > height + precision ||\ - expected_height < height - precision - ) return(false); + qAbs(expected_width - width) > 1.0 || + qAbs(expected_height - height) > 1.0 + ) { + qDebug() << "Conductor::fromXml : les segments du conducteur ne semblent pas coherents - utilisation d'un trajet automatique"; + return(false); + } /* on recree les segments a partir des donnes XML */ // cree la liste de points