From: rnc Date: Wed, 25 Apr 2012 09:33:53 +0000 (+0000) Subject: fixed a bug in snapshot tool of the Feature Detection dlg X-Git-Tag: TRIPOLI_323~11 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=00cdc260ae97397bf769fa05b7aac153e2401afa;p=modules%2Fgeom.git fixed a bug in snapshot tool of the Feature Detection dlg --- diff --git a/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx b/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx index d7e580cdb..d5f11d235 100644 --- a/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx +++ b/src/EntityGUI/EntityGUI_FeatureDetectorDlg.cxx @@ -24,6 +24,7 @@ // File : EntityGUI_SketcherDlg.cxx // Author : Renaud NEDELEC, Open CASCADE S.A.S. +// SALOME includes #include "EntityGUI_FeatureDetectorDlg.h" #include @@ -51,7 +52,9 @@ #include #include +#include +// OCCT includes #include #include #include @@ -67,11 +70,11 @@ #include -#include - +// C++ includes #include #include +// boost includes #include // Constructors @@ -440,7 +443,7 @@ void EntityGUI_FeatureDetectorDlg::setEndPnt(const gp_Pnt& theEndPnt) { myEndPnt = theEndPnt; MESSAGE("myEndPnt = ("<GetImgHeight() > 0) showImageSample(); } @@ -451,8 +454,14 @@ void EntityGUI_FeatureDetectorDlg::setEndPnt(const gp_Pnt& theEndPnt) bool EntityGUI_FeatureDetectorDlg::setSelectionRect() { // Set detection rectangle in the background image coordinates system - QPoint topLeft = QPoint(myStartPnt.X() - pictureLeft, pictureTop - myStartPnt.Y()); - QPoint bottomRight = QPoint(myEndPnt.X() - pictureLeft, pictureTop - myEndPnt.Y()); + double left = std::min( myStartPnt.X(), myEndPnt.X() ); + double top = std::max( myStartPnt.Y(), myEndPnt.Y() ); + double right = std::max( myStartPnt.X(), myEndPnt.X() ); + double bottom = std::min( myStartPnt.Y(), myEndPnt.Y() ); + + QPoint topLeft = QPoint(left - pictureLeft, pictureTop - top ); + QPoint bottomRight = QPoint(right - pictureLeft, pictureTop - bottom); + myRect = QRect(topLeft, bottomRight); return (!myRect.isEmpty() && myRect.width() > 1);