From 8a464e12ecf0be7b04e99307b7adb2207b470cb5 Mon Sep 17 00:00:00 2001 From: asl Date: Mon, 2 Dec 2013 06:13:10 +0000 Subject: [PATCH] bug #136 - problems with performance --- src/HYDROCurveCreator/CurveCreator_Curve.cxx | 6 +++--- src/HYDROCurveCreator/CurveCreator_Displayer.cxx | 12 +++++++----- src/HYDROCurveCreator/CurveCreator_Displayer.h | 4 ++-- src/HYDROCurveCreator/CurveCreator_Profile.cxx | 2 +- src/HYDROGUI/HYDROGUI_PolylineOp.cxx | 4 ++-- src/HYDROGUI/HYDROGUI_ProfileOp.cxx | 4 ++-- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/HYDROCurveCreator/CurveCreator_Curve.cxx b/src/HYDROCurveCreator/CurveCreator_Curve.cxx index cccf4a20..d0c18958 100644 --- a/src/HYDROCurveCreator/CurveCreator_Curve.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Curve.cxx @@ -352,8 +352,8 @@ void CurveCreator_Curve::getCoordinates( int theISection, int theIPoint, double& void CurveCreator_Curve::redisplayCurve() { if( myDisplayer ) { - myDisplayer->erase(); - myDisplayer->display( constructWire() ); + myDisplayer->erase( false ); + myDisplayer->display( constructWire(), true ); } } @@ -472,7 +472,7 @@ bool CurveCreator_Curve::clearInternal() { // erase curve from the viewer if( myDisplayer ) - myDisplayer->erase(); + myDisplayer->erase( true ); // Delete all allocated data. int i = 0; const int aNbSections = getNbSections(); diff --git a/src/HYDROCurveCreator/CurveCreator_Displayer.cxx b/src/HYDROCurveCreator/CurveCreator_Displayer.cxx index 2de7bf12..92df3234 100644 --- a/src/HYDROCurveCreator/CurveCreator_Displayer.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Displayer.cxx @@ -8,14 +8,14 @@ CurveCreator_Displayer::CurveCreator_Displayer( Handle_AIS_InteractiveContext th CurveCreator_Displayer::~CurveCreator_Displayer(void) { - erase(); + erase( true ); for( int i = 0 ; i < myObjects.size() ; i++ ){ myObjects[i].Nullify(); } myObjects.clear(); } -void CurveCreator_Displayer::display( AISObjectsList theCurveObjects ) +void CurveCreator_Displayer::display( AISObjectsList theCurveObjects, bool isUpdate ) { myObjects = theCurveObjects; if(myObjects.empty()) @@ -23,17 +23,19 @@ void CurveCreator_Displayer::display( AISObjectsList theCurveObjects ) for( int i = 0 ; i < myObjects.size() ; i++ ){ myContext->Display(myObjects[i], Standard_False); } - myContext->UpdateCurrentViewer(); + if( isUpdate ) + myContext->UpdateCurrentViewer(); } -void CurveCreator_Displayer::erase() +void CurveCreator_Displayer::erase( bool isUpdate ) { if(myObjects.empty()) return; for( int i = 0 ; i < myObjects.size() ; i++ ){ myContext->Erase(myObjects[i], Standard_False); } - myContext->UpdateCurrentViewer(); + if( isUpdate ) + myContext->UpdateCurrentViewer(); } Quantity_Color CurveCreator_Displayer::getActiveColor( bool isHL ) diff --git a/src/HYDROCurveCreator/CurveCreator_Displayer.h b/src/HYDROCurveCreator/CurveCreator_Displayer.h index 58f667bb..6bfc8d08 100644 --- a/src/HYDROCurveCreator/CurveCreator_Displayer.h +++ b/src/HYDROCurveCreator/CurveCreator_Displayer.h @@ -16,8 +16,8 @@ public: CurveCreator_Displayer(Handle_AIS_InteractiveContext theContext ); ~CurveCreator_Displayer(void); - void display( AISObjectsList theCurveObjects ); - void erase(); + void display( AISObjectsList theCurveObjects, bool isUpdate ); + void erase( bool isUpdate ); void highlight( const AISObjectsList& theObjects, bool isHL ); protected: diff --git a/src/HYDROCurveCreator/CurveCreator_Profile.cxx b/src/HYDROCurveCreator/CurveCreator_Profile.cxx index bd56d272..0c11fc18 100644 --- a/src/HYDROCurveCreator/CurveCreator_Profile.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Profile.cxx @@ -71,7 +71,7 @@ bool CurveCreator_Profile::clearInternal() { // erase curve from the viewer if( myDisplayer ) - myDisplayer->erase(); + myDisplayer->erase( true ); // Delete all allocated data. mySections[ 0 ]->myPoints.clear(); diff --git a/src/HYDROGUI/HYDROGUI_PolylineOp.cxx b/src/HYDROGUI/HYDROGUI_PolylineOp.cxx index 74cb0f63..8ff209f5 100755 --- a/src/HYDROGUI/HYDROGUI_PolylineOp.cxx +++ b/src/HYDROGUI/HYDROGUI_PolylineOp.cxx @@ -284,7 +284,7 @@ void HYDROGUI_PolylineOp::displayPreview() { CurveCreator_Displayer* aDisplayer = new CurveCreator_Displayer( aCtx ); myCurve->setDisplayer( aDisplayer ); - aDisplayer->display( myCurve->constructWire() ); + aDisplayer->display( myCurve->constructWire(), true ); } } } @@ -300,7 +300,7 @@ void HYDROGUI_PolylineOp::erasePreview() Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext(); if( !aCtx.IsNull() ) { - aDisplayer->erase(); + aDisplayer->erase( true ); } } } diff --git a/src/HYDROGUI/HYDROGUI_ProfileOp.cxx b/src/HYDROGUI/HYDROGUI_ProfileOp.cxx index 1bb26b87..8b11b289 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ProfileOp.cxx @@ -202,7 +202,7 @@ void HYDROGUI_ProfileOp::displayPreview() { CurveCreator_Displayer* aDisplayer = new CurveCreator_Displayer( aCtx ); myProfile->setDisplayer( aDisplayer ); - aDisplayer->display( myProfile->constructWire() ); + aDisplayer->display( myProfile->constructWire(), true ); } } } @@ -216,7 +216,7 @@ void HYDROGUI_ProfileOp::erasePreview() Handle(AIS_InteractiveContext) aCtx = aPanel->getAISContext(); if( !aCtx.IsNull() ) { - aDisplayer->erase(); + aDisplayer->erase( true ); } } } -- 2.39.2