From 341b1dc0368088df2e0f97a27adcc9a2ce6810d8 Mon Sep 17 00:00:00 2001 From: ouv Date: Sat, 1 Dec 2018 17:27:46 +0300 Subject: [PATCH] 0004423: External 20920 Part of the element --- src/GLViewer/GLViewer_Geom.cxx | 48 ++++++++++++++++++++++++++++++ src/GLViewer/GLViewer_Geom.h | 13 +++----- src/GLViewer/GLViewer_Viewer2d.cxx | 2 +- 3 files changed, 53 insertions(+), 10 deletions(-) diff --git a/src/GLViewer/GLViewer_Geom.cxx b/src/GLViewer/GLViewer_Geom.cxx index a296a2219..6df807137 100644 --- a/src/GLViewer/GLViewer_Geom.cxx +++ b/src/GLViewer/GLViewer_Geom.cxx @@ -25,6 +25,54 @@ #define FAR_POINT 1e10 // Value used as a "very distant" co-ordinate #define TOLERANCE 1e-3 +/*! + Contructor +*/ +GLViewer_Rect::GLViewer_Rect() +: myLeft( 0.0 ), + myRight( 0.0 ), + myBottom( 0.0 ), + myTop( 0.0 ) +{ + myIsEmpty = false; +} + +/*! + Contructor +*/ +GLViewer_Rect::GLViewer_Rect( float theLeft, float theRight, float theBottom, float theTop ) +: myLeft( theLeft ), + myRight( theRight ), + myBottom( theBottom ), + myTop( theTop ) +{ + myIsEmpty = false; +} + +/*! + Contructor +*/ +GLViewer_Rect::GLViewer_Rect( QRect theRect ) +{ + myLeft = ( float )theRect.left(); + myRight = ( float )theRect.right(); + myBottom = ( float )theRect.bottom(); + myTop = ( float )theRect.top(); + myIsEmpty = false; +} + +/*! + Contructor +*/ +GLViewer_Rect::GLViewer_Rect( QRectF theRect ) +{ + myLeft = theRect.left(); + myRight = theRect.right(); + myBottom = theRect.bottom(); + myTop = theRect.top(); + myIsEmpty = false; +} + /*! Checks that the rectangle contains point */ diff --git a/src/GLViewer/GLViewer_Geom.h b/src/GLViewer/GLViewer_Geom.h index 22ed1c7a1..79cfcce8b 100644 --- a/src/GLViewer/GLViewer_Geom.h +++ b/src/GLViewer/GLViewer_Geom.h @@ -70,15 +70,10 @@ typedef QList GLViewer_PntList; class GLVIEWER_API GLViewer_Rect { public: - GLViewer_Rect(): myLeft(0.0), myRight(0.0), myBottom(0.0), myTop(0.0) {} - GLViewer_Rect( float theLeft, float theRight, float theBottom, float theTop ) - : myLeft(theLeft), myRight(theRight), myBottom(theBottom), myTop(theTop) {} - GLViewer_Rect( QRect theRect ) { - myLeft = ( float )theRect.left(); myRight = ( float )theRect.right(); - myBottom = ( float )theRect.bottom(); myTop = ( float )theRect.top(); } - GLViewer_Rect( QRectF theRect ) { - myLeft = theRect.left(); myRight = theRect.right(); - myBottom = theRect.bottom(); myTop = theRect.top(); } + GLViewer_Rect(); + GLViewer_Rect( float theLeft, float theRight, float theBottom, float theTop ); + GLViewer_Rect( QRect theRect ); + GLViewer_Rect( QRectF theRect ); float left() const { return myLeft; } float right() const { return myRight; } diff --git a/src/GLViewer/GLViewer_Viewer2d.cxx b/src/GLViewer/GLViewer_Viewer2d.cxx index e18b3dc0c..96e9f0c71 100644 --- a/src/GLViewer/GLViewer_Viewer2d.cxx +++ b/src/GLViewer/GLViewer_Viewer2d.cxx @@ -185,7 +185,7 @@ void GLViewer_Viewer2d::updateBorders() { GLViewer_Object* anObject = *it; GLViewer_Rect* aRect = anObject->getRect(); - if( !anObject->isScalable() || !anObject->getVisible() || aRect->isNull() ) + if( !anObject->isScalable() || !anObject->getVisible() || aRect->isNull() || aRect->isEmpty() ) continue; if( border->isEmpty() ) -- 2.39.2