From cf8527aa31d8406f9355e2c226285195434993de Mon Sep 17 00:00:00 2001 From: asl Date: Fri, 1 Dec 2017 13:19:30 +0300 Subject: [PATCH] refs #1462: temporary patch for performance --- src/HYDROGUI/HYDROGUI_BathymetryPrs.cxx | 2 +- src/HYDROGUI/HYDROGUI_BathymetryPrs.h | 6 ++--- src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx | 32 +++++++++++++++++------ src/HYDROGUI/HYDROGUI_ShapeBathymetry.h | 4 +-- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_BathymetryPrs.cxx b/src/HYDROGUI/HYDROGUI_BathymetryPrs.cxx index e8772e7a..eeb49012 100644 --- a/src/HYDROGUI/HYDROGUI_BathymetryPrs.cxx +++ b/src/HYDROGUI/HYDROGUI_BathymetryPrs.cxx @@ -260,7 +260,7 @@ void HYDROGUI_BathymetryPrs::ClearSelected() aSelectPrs->Clear(); } -void HYDROGUI_BathymetryPrs::SetTextLabels( const QList& theTextIndices ) +void HYDROGUI_BathymetryPrs::SetTextLabels( const QVector& theTextIndices ) { myTextIndices = theTextIndices; } diff --git a/src/HYDROGUI/HYDROGUI_BathymetryPrs.h b/src/HYDROGUI/HYDROGUI_BathymetryPrs.h index 1f5e0df1..1732016d 100644 --- a/src/HYDROGUI/HYDROGUI_BathymetryPrs.h +++ b/src/HYDROGUI/HYDROGUI_BathymetryPrs.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include class HYDROGUI_ShapeBathymetry; @@ -47,7 +47,7 @@ public: virtual void ClearSelected(); - void SetTextLabels( const QList& ); + void SetTextLabels( const QVector& ); HYDROGUI_ShapeBathymetry* GetShape() const; @@ -64,7 +64,7 @@ protected: private: const HYDROGUI_ShapeBathymetry* myShape; Bnd_Box myBound; - QList myTextIndices; + QVector myTextIndices; }; class HYDROGUI_BathymetryPointOwner : public SelectMgr_EntityOwner diff --git a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx index dfc3a62c..4b1df859 100644 --- a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx +++ b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.cxx @@ -27,6 +27,8 @@ #include #include #include +#include +#include HYDROGUI_ShapeBathymetry::HYDROGUI_ShapeBathymetry( HYDROGUI_OCCDisplayer* theDisplayer, const Handle(AIS_InteractiveContext)& theContext, @@ -183,7 +185,7 @@ void HYDROGUI_ShapeBathymetry::GetRange( double& theMin, double& theMax ) const void HYDROGUI_ShapeBathymetry::RescaleByVisible( OCCViewer_ViewWindow* theWindow ) { - QList visible; + QVector visible; visible.reserve( myCoords->Size() ); OCCViewer_ViewPort3d* vp = theWindow->getViewPort(); @@ -192,8 +194,16 @@ void HYDROGUI_ShapeBathymetry::RescaleByVisible( OCCViewer_ViewWindow* theWindow int xp, yp; int w = vp->width(); int h = vp->height(); + int n = myCoords->Upper(); bool isVisible; - for( int i=myCoords->Lower(), n=myCoords->Upper(); i<=n; i++ ) + +#ifdef _DEBUG + MESSAGE("RescaleByVisible: " << n); + QTime t1; + t1.start(); +#endif + + for( int i=myCoords->Lower(); i<=n; i++ ) { gp_Pnt p = myCoords->Value( i ); v->Convert( p.X(), p.Y(), p.Z(), xp, yp ); @@ -202,14 +212,20 @@ void HYDROGUI_ShapeBathymetry::RescaleByVisible( OCCViewer_ViewWindow* theWindow visible.append( i ); } +#ifdef _DEBUG + MESSAGE("Time after visibles search:" << t1.elapsed()); +#endif + //TODO: question: empty visible part produce empty bathymetry or complete bathymetry? // For now "complete" is implemented Rescale( visible, visible.isEmpty() ); + + MESSAGE("Time after rescale:" << t1.elapsed()); } -QList HYDROGUI_ShapeBathymetry::selected() const +QVector HYDROGUI_ShapeBathymetry::selected() const { - QList selected; + QVector selected; selected.reserve( myCoords->Size() ); Handle(AIS_InteractiveContext) c = getContext(); @@ -232,7 +248,7 @@ QList HYDROGUI_ShapeBathymetry::selected() const void HYDROGUI_ShapeBathymetry::RescaleBySelection() { - QList selection = selected(); + QVector selection = selected(); //TODO: question: empty selection produce empty bathymetry or complete bathymetry? // For now "complete" is implemented @@ -252,10 +268,10 @@ void HYDROGUI_ShapeBathymetry::Rescale( double theMin, double theMax ) void HYDROGUI_ShapeBathymetry::RescaleDefault() { - Rescale( QList(), true ); + Rescale( QVector(), true ); } -void HYDROGUI_ShapeBathymetry::Rescale( const QList& theIndices, bool isForcedAll ) +void HYDROGUI_ShapeBathymetry::Rescale( const QVector& theIndices, bool isForcedAll ) { double aMin = 0, aMax = 0; if( !myCoords.IsNull() ) @@ -291,7 +307,7 @@ void HYDROGUI_ShapeBathymetry::TextLabels( bool isOn ) if( prs.IsNull() ) return; - QList selection; + QVector selection; if( isOn ) selection = selected(); diff --git a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.h b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.h index 81433724..e6ee5130 100644 --- a/src/HYDROGUI/HYDROGUI_ShapeBathymetry.h +++ b/src/HYDROGUI/HYDROGUI_ShapeBathymetry.h @@ -67,9 +67,9 @@ protected: virtual void displayShape( const bool theIsUpdateViewer ); void setToUpdateColorScale( bool isChanged ); - void Rescale( const QList& theIndices, bool isForcedAll ); + void Rescale( const QVector& theIndices, bool isForcedAll ); - QList selected() const; + QVector selected() const; private: HYDROGUI_OCCDisplayer* myDisplayer; -- 2.39.2