From: vsr Date: Wed, 23 Jun 2010 12:31:05 +0000 (+0000) Subject: IPAL21797: Shrink factor is disabled for Point Map 3D Definition X-Git-Tag: V5_1_main_20100624~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c6e5b3cb00059dee9bf5cc9ff9346083d452830c;p=modules%2Fvisu.git IPAL21797: Shrink factor is disabled for Point Map 3D Definition --- diff --git a/src/OBJECT/VISU_ActorBase.cxx b/src/OBJECT/VISU_ActorBase.cxx index ae6c8e9d..fbb889e3 100644 --- a/src/OBJECT/VISU_ActorBase.cxx +++ b/src/OBJECT/VISU_ActorBase.cxx @@ -161,6 +161,22 @@ bool VISU_ActorBase::IsShrunkable() return myIsShrinkable; } +void +VISU_ActorBase +::SetShrinkFactor(vtkFloatingPointType theValue) +{ + myShrinkFilter->SetShrinkFactor(theValue); + Modified(); +} + +vtkFloatingPointType +VISU_ActorBase +::GetShrinkFactor() +{ + return myShrinkFilter->GetShrinkFactor(); +} + + //-------------------------------------------------------------------------------------- void VISU_ActorBase::RemoveFromRender(vtkRenderer* theRenderer) diff --git a/src/OBJECT/VISU_ActorBase.h b/src/OBJECT/VISU_ActorBase.h index 10645c40..b4e2da39 100644 --- a/src/OBJECT/VISU_ActorBase.h +++ b/src/OBJECT/VISU_ActorBase.h @@ -64,6 +64,9 @@ class VISU_OBJECT_EXPORT VISU_ActorBase: public SALOME_Actor, virtual bool IsShrunkable(); virtual bool IsShrunk(); virtual void SetShrinkable(bool theIsShrinkable); + + virtual void SetShrinkFactor(vtkFloatingPointType theFactor = 0.8); + virtual vtkFloatingPointType GetShrinkFactor(); virtual void SetRepresentation(int theMode); diff --git a/src/VISUGUI/VisuGUI_ShrinkFactorDlg.cxx b/src/VISUGUI/VisuGUI_ShrinkFactorDlg.cxx index 0d755a9a..fc6d6b63 100644 --- a/src/VISUGUI/VisuGUI_ShrinkFactorDlg.cxx +++ b/src/VISUGUI/VisuGUI_ShrinkFactorDlg.cxx @@ -53,6 +53,7 @@ #include const int DEFAULT_SHRINK = 80; +const int UNDEF_SHRINK = -1; //================================================================================= // class : VisuGUI_ShrinkFactorDlg() @@ -174,10 +175,19 @@ void VisuGUI_ShrinkFactorDlg::setShrinkFactor() for ( ; anIter.More(); anIter.Next() ) { Handle(SALOME_InteractiveObject) anIO = anIter.Value(); VISU_Actor* anActor = VISU::FindActor( VISU::GetAppStudy( myModule ), myViewWindow, anIO->getEntry() ); - if ( anActor && anActor->IsShrunkable() ) - anActor->SetShrinkFactor( shrink ); + if ( anActor ) { + if ( anActor->IsShrunkable() ) + anActor->SetShrinkFactor( shrink ); + } + else { + VISU_ActorBase* anActor = VISU::FindActorBase(VISU::GetAppStudy(myModule), myViewWindow, anIO->getEntry()); + if ( anActor ) { + if ( anActor->IsShrunkable() ) + anActor->SetShrinkFactor( shrink ); + } + } } - myViewWindow->Repaint(); + myViewWindow->Repaint(); } } @@ -189,49 +199,42 @@ void VisuGUI_ShrinkFactorDlg::onSelectionChanged() { bool shrinkable = false; if ( myViewWindow ) { - int shrink = DEFAULT_SHRINK; + int shrinkFactor = UNDEF_SHRINK; SALOME_ListIO aList; mySelectionMgr->selectedObjects( aList ); - if ( aList.Extent() == 1 ) { - Handle(SALOME_InteractiveObject) FirstIOS = aList.First(); - if ( !FirstIOS.IsNull() ) { - VISU_Actor* anActor = VISU::FindActor( VISU::GetAppStudy( myModule ), myViewWindow, FirstIOS->getEntry() ); - if ( anActor ) { - shrinkable = anActor->IsShrunkable(); - if ( shrinkable ) - shrink = int( anActor->GetShrinkFactor() * 100. + 0.5 ); - } - } - } - else if ( aList.Extent() > 1 ) { - SALOME_ListIteratorOfListIO It( aList ); - int setShr = -1; - for ( ; It.More(); It.Next() ) { - Handle(SALOME_InteractiveObject) IO = It.Value(); - if (!IO.IsNull()) { - VISU_Actor* anActor = VISU::FindActor( VISU::GetAppStudy( myModule ), myViewWindow, IO->getEntry() ); - if ( anActor ) { - bool lshrinkable = anActor->IsShrunkable(); - shrinkable = shrinkable || lshrinkable; - if ( lshrinkable ) { - int shr = int( anActor->GetShrinkFactor() * 100. + 0.5 ); - if ( setShr < 0 ) - setShr = shr; - else if ( setShr != shr ) { - setShr = DEFAULT_SHRINK; - break; - } - } - } - } + SALOME_ListIteratorOfListIO It( aList ); + for ( ; It.More(); It.Next() ) { + Handle(SALOME_InteractiveObject) IO = It.Value(); + if (!IO.IsNull()) { + bool ashrinkable = false; + int shr = UNDEF_SHRINK; + VISU_Actor* anActor = VISU::FindActor( VISU::GetAppStudy( myModule ), myViewWindow, IO->getEntry() ); + if ( anActor ) { + ashrinkable = anActor->IsShrunkable(); + if ( ashrinkable ) shr = int( anActor->GetShrinkFactor() * 100. + 0.5 ); + } + else { + VISU_ActorBase* anActor = VISU::FindActorBase(VISU::GetAppStudy(myModule), myViewWindow, IO->getEntry()); + if ( anActor ) { + ashrinkable = anActor->IsShrunkable(); + if ( ashrinkable ) shr = int( anActor->GetShrinkFactor() * 100. + 0.5 ); + } + } + shrinkable = shrinkable || ashrinkable; + if ( shr != UNDEF_SHRINK ) { + if ( shrinkFactor == UNDEF_SHRINK ) + shrinkFactor = shr; + else if ( shrinkFactor != shr ) { + shrinkFactor = DEFAULT_SHRINK; + break; + } + } } - if ( setShr >= 0 ) - shrink = setShr; } ValueSpin->blockSignals( true ); - ValueSpin->setValue( shrink ); + ValueSpin->setValue( shrinkFactor == UNDEF_SHRINK ? DEFAULT_SHRINK : shrinkFactor ); ValueSpin->blockSignals( false ); } GroupC1->setEnabled( shrinkable );