From d39cd99f1b0f07b73190a1b77e6a115e36985c5f Mon Sep 17 00:00:00 2001 From: nge Date: Wed, 16 Jul 2008 11:43:35 +0000 Subject: [PATCH] *** empty log message *** --- src/OCCViewer/OCCViewer_ViewModel.cxx | 30 ++++++++++++++++ src/OCCViewer/OCCViewer_ViewModel.h | 16 ++++++++- src/SOCC/SOCC_ViewModel.cxx | 51 ++++++++++++++++++++------- 3 files changed, 83 insertions(+), 14 deletions(-) diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index 5e64aafb3..1f4dd75b7 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -40,6 +40,8 @@ #include #include +#define MESSAGE(STR) std::cerr << __FILE__ << " [" << __LINE__ << "] : " << STR << std::endl; + /*! Constructor \param DisplayTrihedron - is trihedron displayed @@ -604,12 +606,20 @@ void OCCViewer_Viewer::setTrihedronSize( const double sz ) */ void OCCViewer_Viewer::setIsos( const int u, const int v ) { +#if 0 Handle(AIS_InteractiveContext) ic = getAISContext(); if ( ic.IsNull() ) return; ic->SetIsoNumber( u, AIS_TOI_IsoU ); ic->SetIsoNumber( v, AIS_TOI_IsoV ); +#else + if ( !myAISContext.IsNull() ) + { + myAISContext->SetIsoNumber( u, AIS_TOI_IsoU ); + myAISContext->SetIsoNumber( v, AIS_TOI_IsoV ); + } +#endif } /*! @@ -619,10 +629,30 @@ void OCCViewer_Viewer::setIsos( const int u, const int v ) */ void OCCViewer_Viewer::isos( int& u, int& v ) const { +#if 0 Handle(AIS_InteractiveContext) ic = getAISContext(); if ( !ic.IsNull() ) { u = ic->IsoNumber( AIS_TOI_IsoU ); v = ic->IsoNumber( AIS_TOI_IsoV ); } +#else + if ( !myAISContext.IsNull() ) + { + myAISContext->IsoNumber( AIS_TOI_IsoU ); + myAISContext->IsoNumber( AIS_TOI_IsoV ); + } +#endif +} + +/*! + \param entry - Entry of interactive object + \param io - Interactive object +*/ +void OCCViewer_Viewer::registerIOWithEntry(const std::string entry,const Handle(AIS_InteractiveObject) io) +{ + MESSAGE("===== PERF ====="); + if (!entry.size() || io.IsNull()) + return; + myMapOfEntryIO[entry] = io; } diff --git a/src/OCCViewer/OCCViewer_ViewModel.h b/src/OCCViewer/OCCViewer_ViewModel.h index e43201ada..090a659da 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.h +++ b/src/OCCViewer/OCCViewer_ViewModel.h @@ -31,6 +31,10 @@ #include #include +// GDD PERF +//~ #include +// + class SUIT_ViewWindow; class SUIT_Desktop; class OCCViewer_ViewWindow; @@ -59,6 +63,10 @@ public: typedef QValueList viewAspectList; +// GDD PERF +typedef QMap MapOfEntryIO; +// + #ifdef WIN32 #pragma warning( disable:4251 ) #endif @@ -115,6 +123,10 @@ public: Handle(V3d_Viewer) getViewer3d() const { return myV3dViewer;} Handle(V3d_Viewer) getCollector3d() const { return myV3dCollector; } Handle(AIS_InteractiveContext) getAISContext() const { return myAISContext; } + // GDD PERF + MapOfEntryIO getMapOfEntryIO() const { return myMapOfEntryIO; } + void registerIOWithEntry(const std::string entry,const Handle(AIS_InteractiveObject) io); + // Handle(AIS_Trihedron) getTrihedron() const { return myTrihedron; } void enableSelection(bool isEnabled); @@ -162,7 +174,9 @@ private: Handle(AIS_Trihedron) myTrihedron; Handle(AIS_InteractiveContext) myAISContext; - + // GDD PERF + MapOfEntryIO myMapOfEntryIO; + // viewAspectList myViewAspects; bool mySelectionEnabled; diff --git a/src/SOCC/SOCC_ViewModel.cxx b/src/SOCC/SOCC_ViewModel.cxx index 539836496..bf84fddf1 100755 --- a/src/SOCC/SOCC_ViewModel.cxx +++ b/src/SOCC/SOCC_ViewModel.cxx @@ -52,14 +52,20 @@ #include #include -static long tt0; -static long tcount=0; -static long cumul; -#define START_TIMING timeval tv; gettimeofday(&tv,0);tt0=tv.tv_usec+tv.tv_sec*1000000; -#define END_TIMING(NUMBER) \ - tcount=tcount+1;gettimeofday(&tv,0);cumul=cumul+tv.tv_usec+tv.tv_sec*1000000 -tt0; \ - if(tcount==NUMBER){ std::cerr << __FILE__ << __LINE__ << " temps CPU(mus): " << cumul << std::endl; tcount=0;cumul=0; } - +static int IDMax=10; +static long tt0[10]={0,0,0,0,0,0,0,0,0,0}; +static long tcount[10]={0,0,0,0,0,0,0,0,0,0}; +static long cumul[10]={0,0,0,0,0,0,0,0,0,0}; +timeval tv; +#define START_TIMING(ID) if (ID( prs ); if ( !anOCCPrs || anOCCPrs->IsNull() ) @@ -413,7 +419,7 @@ void SOCC_Viewer::Display( const SALOME_OCCPrs* prs ) ic->Deactivate( anAIS ); } } - END_TIMING(200) + //~ END_TIMING(200) } @@ -522,21 +528,37 @@ void SOCC_Viewer::EraseAll( const bool forced ) */ SALOME_Prs* SOCC_Viewer::CreatePrs( const char* entry ) { + //~ START_TIMING(0) SOCC_Prs* prs = new SOCC_Prs(); + if ( entry ) { +#ifdef PERF + MESSAGE("=== PERF ==="); + MapOfEntryIO myMapOfEntryIO = getMapOfEntryIO() ; + MESSAGE("=== PERF === myMapOfEntryIO.size(): " << myMapOfEntryIO.size()); + if (myMapOfEntryIO.contains(entry)) { + MESSAGE("=== PERF === entry:" << entry); + prs->AddObject( myMapOfEntryIO[entry]); + } + MESSAGE("=== PERF ==="); +#else // get context Handle(AIS_InteractiveContext) ic = getAISContext(); - // get displayed objects AIS_ListOfInteractive List; + //~ START_TIMING(1) ic->DisplayedObjects( List ); + //~ END_TIMING(1,200) // get objects in the collector AIS_ListOfInteractive ListCollector; + //~ START_TIMING(2) ic->ObjectsInCollector( ListCollector ); + //~ END_TIMING(2,200) List.Append( ListCollector ); AIS_ListIteratorOfListOfInteractive ite( List ); + //~ START_TIMING(3) for ( ; ite.More(); ite.Next() ) { Handle(SALOME_InteractiveObject) anObj = @@ -544,8 +566,13 @@ SALOME_Prs* SOCC_Viewer::CreatePrs( const char* entry ) if ( !anObj.IsNull() && anObj->hasEntry() && strcmp( anObj->getEntry(), entry ) == 0 ) prs->AddObject( ite.Value() ); + break; } +#endif } + //~ END_TIMING(3,200) + + //~ END_TIMING(0,200) return prs; } @@ -672,10 +699,8 @@ bool SOCC_Viewer::getTrihedronSize( double& theNewSize, double& theSize ) */ void SOCC_Viewer::Repaint() { - std::cerr << "SOCC_Viewer::Repaint" << std::endl; // onAdjustTrihedron(); getViewer3d()->Update(); - std::cerr << "end of SOCC_Viewer::Repaint" << std::endl; } -- 2.39.2