From f29fc3cc1b08feec27fe150a37a82785e42abe3f Mon Sep 17 00:00:00 2001 From: asv Date: Wed, 22 Jun 2005 06:31:53 +0000 Subject: [PATCH] Bug fixes. --- src/OCCViewer/OCCViewer_ViewModel.cxx | 20 +++++++++++++++ src/OCCViewer/OCCViewer_ViewModel.h | 2 ++ src/SOCC/SOCC_ViewModel.cxx | 35 +++++++++++++++------------ src/SalomeApp/SalomeApp_Tools.h | 8 +++--- 4 files changed, 45 insertions(+), 20 deletions(-) diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index 5c03a236f..a1fb001b3 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -425,3 +425,23 @@ void OCCViewer_Viewer::setTrihedronSize( const int sz ) if ( !myTrihedron.IsNull() ) myTrihedron->SetSize( sz ); } + +void OCCViewer_Viewer::setIsos( const int u, const int v ) +{ + Handle(AIS_InteractiveContext) ic = getAISContext(); + if ( !ic.IsNull() ) + { + ic->SetIsoNumber( u, AIS_TOI_IsoU ); + ic->SetIsoNumber( u, AIS_TOI_IsoV ); + } +} + +void OCCViewer_Viewer::isos( int& u, int& v ) const +{ + Handle(AIS_InteractiveContext) ic = getAISContext(); + if ( !ic.IsNull() ) + { + u = ic->IsoNumber( AIS_TOI_IsoU ); + v = ic->IsoNumber( AIS_TOI_IsoV ); + } +} diff --git a/src/OCCViewer/OCCViewer_ViewModel.h b/src/OCCViewer/OCCViewer_ViewModel.h index 08bf29f06..d42be6a25 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.h +++ b/src/OCCViewer/OCCViewer_ViewModel.h @@ -115,6 +115,8 @@ public: void setColor( const Handle(AIS_InteractiveObject)&, const QColor&, bool=true ); void switchRepresentation( const Handle(AIS_InteractiveObject)&, int, bool=true ); void setTransparency( const Handle(AIS_InteractiveObject)&, float, bool=true ); + void setIsos( const int u, const int v ); // number of isolines + void isos( int& u, int& v ) const; signals: void selectionChanged(); diff --git a/src/SOCC/SOCC_ViewModel.cxx b/src/SOCC/SOCC_ViewModel.cxx index c21735bba..686cd58fc 100755 --- a/src/SOCC/SOCC_ViewModel.cxx +++ b/src/SOCC/SOCC_ViewModel.cxx @@ -24,6 +24,8 @@ #include "SALOMEDSClient.hxx" #include "SALOMEDS_StudyManager.hxx" +#include + // in order NOT TO link with SalomeApp, here the code returns SALOMEDS_Study. // SalomeApp_Study::studyDS() does it as well, but -- here it is retrieved from // SALOMEDS::StudyManager - no linkage with SalomeApp. @@ -469,23 +471,23 @@ SALOME_Prs* SOCC_Viewer::CreatePrs( const char* entry ) //======================================================================= void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode ) { - Handle(AIS_InteractiveContext) anIC = getAISContext(); + Handle(AIS_InteractiveContext) ic = getAISContext(); const SOCC_Prs* anOCCPrs = dynamic_cast( thePrs ); - if ( anIC.IsNull() ) + if ( ic.IsNull() ) return; // Open local context if there is no one bool allObjects = thePrs == 0 || thePrs->IsNull(); - if ( !anIC->HasOpenedContext() ) { - anIC->ClearCurrents( false ); - anIC->OpenLocalContext( allObjects, true, true ); + if ( !ic->HasOpenedContext() ) { + ic->ClearCurrents( false ); + ic->OpenLocalContext( allObjects, true, true ); } AIS_ListOfInteractive anObjs; // Get objects to be activated if ( allObjects ) - anIC->DisplayedObjects( anObjs ); + ic->DisplayedObjects( anObjs ); else anOCCPrs->GetObjects( anObjs ); @@ -497,13 +499,13 @@ void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode { if ( anAIS->IsKind( STANDARD_TYPE( AIS_Shape ) ) ) { - anIC->Load( anAIS, -1, false ); - anIC->Activate( anAIS, AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)theMode ) ); + ic->Load( anAIS, -1, false ); + ic->Activate( anAIS, AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)theMode ) ); } else if ( anAIS->DynamicType() != STANDARD_TYPE(AIS_Trihedron) ) { - anIC->Load( anAIS, -1, false ); - anIC->Activate( anAIS, theMode ); + ic->Load( anAIS, -1, false ); + ic->Activate( anAIS, theMode ); } } } @@ -515,11 +517,13 @@ void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode //======================================================================= void SOCC_Viewer::GlobalSelection( const bool update ) const { - Handle(AIS_InteractiveContext) anIC = getAISContext(); - if ( !anIC.IsNull() ) - anIC->CloseAllContexts( false ); - if ( update ) - anIC->CurrentViewer()->Redraw(); + Handle(AIS_InteractiveContext) ic = getAISContext(); + if ( !ic.IsNull() ) + { + ic->CloseAllContexts( false ); + if ( update ) + ic->CurrentViewer()->Redraw(); + } } //======================================================================= @@ -593,4 +597,3 @@ void SOCC_Viewer::Repaint() // onAdjustTrihedron(); getViewer3d()->Update(); } - diff --git a/src/SalomeApp/SalomeApp_Tools.h b/src/SalomeApp/SalomeApp_Tools.h index 679fef748..6a7b8e0e6 100644 --- a/src/SalomeApp/SalomeApp_Tools.h +++ b/src/SalomeApp/SalomeApp_Tools.h @@ -16,11 +16,11 @@ class SALOMEAPP_EXPORT SalomeApp_Tools : public SUIT_Tools { public: - Quantity_Color color( const QColor& ); - QColor color( const Quantity_Color& ); + static Quantity_Color color( const QColor& ); + static QColor color( const Quantity_Color& ); - static QString ExceptionToString( const SALOME::SALOME_Exception& ); - static void QtCatchCorbaException( const SALOME::SALOME_Exception& ); + static QString ExceptionToString( const SALOME::SALOME_Exception& ); + static void QtCatchCorbaException( const SALOME::SALOME_Exception& ); }; #endif -- 2.39.2