From 614b1eb4d08c3de014dfef6b7ed6738775c0309a Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 15 Jul 2009 08:13:17 +0000 Subject: [PATCH] Merge from V5_1_2_BR branch (14 July 2009) --- src/CONVERTOR/VISU_MedConvertor.cxx | 13 +++-- src/OBJECT/VISU_Actor.cxx | 22 +++++++- src/OBJECT/VISU_GaussPtsAct.cxx | 1 - src/OBJECT/VISU_MeshAct.cxx | 1 + src/OBJECT/VISU_ScalarMapAct.cxx | 3 +- src/PIPELINE/VISU_ColoredPL.cxx | 5 +- src/PIPELINE/VISU_CutLinesPL.cxx | 4 ++ src/PIPELINE/VISU_CutPlanesPL.cxx | 8 ++- .../VISU_DeformedShapeAndScalarMapPL.cxx | 5 +- src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx | 7 +++ src/PIPELINE/VISU_PipeLineUtils.cxx | 13 +++++ src/PIPELINE/VISU_PipeLineUtils.hxx | 5 ++ src/PIPELINE/VISU_Plot3DPL.cxx | 9 ++-- src/VISUGUI/VISU_msg_en.ts | 9 +++- src/VISUGUI/VisuGUI.cxx | 39 +++++--------- src/VISUGUI/VisuGUI.h | 10 ++-- src/VISUGUI/VisuGUI_BuildProgressDlg.cxx | 6 +-- src/VISUGUI/VisuGUI_ClippingPanel.cxx | 8 +-- src/VISUGUI/VisuGUI_ClippingPanel.h | 4 +- .../VisuGUI_DeformedShapeAndScalarMapDlg.cxx | 45 +++++++++++----- .../VisuGUI_DeformedShapeAndScalarMapDlg.h | 6 +++ src/VISUGUI/VisuGUI_FeatureEdgesPanel.cxx | 31 ++++++++--- src/VISUGUI/VisuGUI_FeatureEdgesPanel.h | 6 ++- src/VISUGUI/VisuGUI_Panel.cxx | 54 ++++++++++++------- src/VISUGUI/VisuGUI_Panel.h | 16 +++--- src/VISUGUI/VisuGUI_SelectionPanel.cxx | 35 ++++++++---- src/VISUGUI/VisuGUI_SelectionPanel.h | 6 ++- src/VISUGUI/VisuGUI_TimeAnimation.cxx | 5 +- src/VISUGUI/VisuGUI_Tools.cxx | 44 +++++++-------- src/VISU_I/VISU_GaussPoints_i.cc | 2 +- src/VISU_I/VISU_Prs3d_i.cc | 1 + 31 files changed, 287 insertions(+), 136 deletions(-) diff --git a/src/CONVERTOR/VISU_MedConvertor.cxx b/src/CONVERTOR/VISU_MedConvertor.cxx index 467a4957..2c7fdf28 100644 --- a/src/CONVERTOR/VISU_MedConvertor.cxx +++ b/src/CONVERTOR/VISU_MedConvertor.cxx @@ -46,6 +46,11 @@ #include +#ifdef WNT +#include +#define isnan _isnan +#endif + using MED::TInt; using MED::TFloat; using MED::EBooleen; @@ -1657,8 +1662,8 @@ BuildTimeStampMinMax(MED::SharedPtr theTimeStampValue, for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){ const vtkFloatingPointType& aVal = aMValueSlice[iGauss]; - aMin = std::min(aMin,aVal); - aMax = std::max(aMax,aVal); + aMin = isnan(aVal) ? aVal : std::min(aMin,aVal); + aMax = isnan(aVal) ? aVal : std::max(aMax,aVal); if(isAverageByGaussPoints){ anAverageValue += aVal; } @@ -1746,8 +1751,8 @@ BuildTimeStampMinMax(MED::SharedPtr theTimeStampValue, aValue += aVal*aVal; } aValue = sqrt(aValue); - aMin = std::min(aMin,aValue); - aMax = std::max(aMax,aValue); + aMin = isnan(aValue) ? aValue : std::min(aMin,aValue); + aMax = isnan(aValue) ? aValue : std::max(aMax,aValue); // additional calculation for each group, to which the element belongs VISU::TNames::const_iterator aGroupIter = aGroupNames.begin(); diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index 8a5ca950..1c29b5d7 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -31,6 +31,7 @@ #include "VISU_PipeLine.hxx" +#include "SVTK_Actor.h" #include "SVTK_Event.h" #include "VTKViewer_FramedTextActor.h" @@ -548,6 +549,9 @@ VISU_Actor { Superclass::SetVisibility( theMode ); myValLabels->SetVisibility( myIsValLabeled && theMode ); + + // Moved from VISU_GaussPtsAct::SetVisibility() (due to IPAL21159) + Highlight(isHighlighted()); } //---------------------------------------------------------------------------- //! Gets know whether the actor should be displayed or not @@ -1087,6 +1091,11 @@ VISU_Actor vtkFloatingPointType aDollyWas = anInteractor->GetDolly(); int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames(); + double aPosition[3]; + GetPosition( aPosition ); + for( int i = 0; i < 3; i++ ) + aFlyToCoord[i] += aPosition[i]; + anInteractor->SetDolly(0.0); anInteractor->SetNumberOfFlyFrames(aPickingSettings->GetStepNumber()); anInteractor->FlyTo(aRenderer, aFlyToCoord); @@ -1270,5 +1279,16 @@ VISU_Actor::GetQuadratic2DRepresentation() const void VISU_Actor::SetQuadratic2DRepresentation( EQuadratic2DRepresentation theMode ) { - + switch(theMode) { + case VISU_Actor::eArcs: + myPreHighlightActor->SetQuadraticArcMode(true); + myHighlightActor->SetQuadraticArcMode(true); + break; + case VISU_Actor::eLines: + myPreHighlightActor->SetQuadraticArcMode(false); + myHighlightActor->SetQuadraticArcMode(false); + break; + default: + break; + } } diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index 2fc55456..58272e97 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -549,7 +549,6 @@ VISU_GaussPtsAct Superclass::SetVisibility(theMode); myDeviceActor->SetVisibility(GetVisibility()); // VSV myScalarBarCtrl->SetVisibility(theMode); - Highlight(isHighlighted()); } int diff --git a/src/OBJECT/VISU_MeshAct.cxx b/src/OBJECT/VISU_MeshAct.cxx index c5c87fe5..410d91bf 100644 --- a/src/OBJECT/VISU_MeshAct.cxx +++ b/src/OBJECT/VISU_MeshAct.cxx @@ -416,6 +416,7 @@ VISU_MeshAct::GetQuadratic2DRepresentation() const void VISU_MeshAct::SetQuadratic2DRepresentation( EQuadratic2DRepresentation theMode ) { + Superclass::SetQuadratic2DRepresentation( theMode ); switch(theMode) { case VISU_Actor::eArcs: mySurfaceActor->SetQuadraticArcMode(true); diff --git a/src/OBJECT/VISU_ScalarMapAct.cxx b/src/OBJECT/VISU_ScalarMapAct.cxx index e68b8375..51e3ed80 100644 --- a/src/OBJECT/VISU_ScalarMapAct.cxx +++ b/src/OBJECT/VISU_ScalarMapAct.cxx @@ -526,7 +526,7 @@ VISU_ScalarMapAct { myBarVisibility = theMode; if(myScalarBar) - myScalarBar->SetVisibility(myBarVisibility); + myScalarBar->SetVisibility(myBarVisibility && GetVisibility()); } @@ -667,6 +667,7 @@ VISU_ScalarMapAct void VISU_ScalarMapAct::SetQuadratic2DRepresentation( VISU_Actor::EQuadratic2DRepresentation theMode ) { + Superclass::SetQuadratic2DRepresentation( theMode ); switch(theMode) { case VISU_Actor::eArcs: mySurfaceActor->SetQuadraticArcMode(true); diff --git a/src/PIPELINE/VISU_ColoredPL.cxx b/src/PIPELINE/VISU_ColoredPL.cxx index e797a1a2..c7027903 100644 --- a/src/PIPELINE/VISU_ColoredPL.cxx +++ b/src/PIPELINE/VISU_ColoredPL.cxx @@ -170,6 +170,9 @@ void VISU_ColoredPL ::SetScalarRange( vtkFloatingPointType theRange[2] ) { + if (isnan(theRange[0]) || isnan(theRange[1])) + throw std::runtime_error("NAN values in the presentation"); + if ( theRange[0] > theRange[1] ) return; @@ -502,7 +505,7 @@ VISU_ColoredPL myExtractor->GetOutput()->GetScalarRange( theRange ); if (isnan(theRange[0]) || isnan(theRange[1])) - throw std::runtime_error("Arithmetic exception detected"); + throw std::runtime_error("NAN values in the presentation"); } void diff --git a/src/PIPELINE/VISU_CutLinesPL.cxx b/src/PIPELINE/VISU_CutLinesPL.cxx index 0a0b7340..7fcfb1fd 100644 --- a/src/PIPELINE/VISU_CutLinesPL.cxx +++ b/src/PIPELINE/VISU_CutLinesPL.cxx @@ -160,6 +160,10 @@ void VISU_CutLinesPL ::Update() { + vtkDataSet* aMergedInput = GetMergedInput(); + if(VISU::IsQuadraticData(aMergedInput)) // Bug 0020123, note 0005343 + throw std::runtime_error("Impossible to build presentation"); + ClearAppendPolyData(myAppendPolyData); SetPartPosition(1); diff --git a/src/PIPELINE/VISU_CutPlanesPL.cxx b/src/PIPELINE/VISU_CutPlanesPL.cxx index ca90de17..c9b541cc 100644 --- a/src/PIPELINE/VISU_CutPlanesPL.cxx +++ b/src/PIPELINE/VISU_CutPlanesPL.cxx @@ -156,15 +156,19 @@ void VISU_CutPlanesPL ::Update() { + vtkDataSet* aMergedInput = GetMergedInput(); + if(VISU::IsQuadraticData(aMergedInput)) // Bug 0020123, note 0005343 + throw std::runtime_error("Impossible to build presentation"); + ClearAppendPolyData(myAppendPolyData); if(!myVectorialField || !IsDeformed()){ - SetMergeFilterInput(GetMergedInput(),GetMergedInput()); + SetMergeFilterInput(aMergedInput,aMergedInput); } - if(VISU::IsDataOnCells(GetMergedInput())) + if(VISU::IsDataOnCells(aMergedInput)) GetMapper()->SetScalarModeToUseCellData(); else GetMapper()->SetScalarModeToUsePointData(); diff --git a/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.cxx b/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.cxx index 34f1a8ae..2da76c09 100644 --- a/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.cxx +++ b/src/PIPELINE/VISU_DeformedShapeAndScalarMapPL.cxx @@ -434,6 +434,9 @@ void VISU_DeformedShapeAndScalarMapPL ::SetScalarRange(vtkFloatingPointType theRange[2]) { + if (isnan(theRange[0]) || isnan(theRange[1])) + throw std::runtime_error("NAN values in the presentation"); + if(VISU::CheckIsSameRange(theRange, GetScalarRange())) return; @@ -466,5 +469,5 @@ VISU_DeformedShapeAndScalarMapPL myScalarsExtractor->GetUnstructuredGridOutput()->GetScalarRange(theRange); if (isnan(theRange[0]) || isnan(theRange[1])) - throw std::runtime_error("Arithmetic exception detected"); + throw std::runtime_error("NAN values in the presentation"); } diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index fd54f6e0..6662b6bd 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -371,6 +371,7 @@ void VISU_OpenGLPointSpriteMapper::SetPointSpriteClamp( float theClamp ) return; this->PointSpriteClamp = theClamp; + this->Modified(); } //----------------------------------------------------------------------------- @@ -380,6 +381,7 @@ void VISU_OpenGLPointSpriteMapper::SetAverageCellSize(float theSize) return; this->AverageCellSize = theSize; + this->Modified(); } //----------------------------------------------------------------------------- @@ -389,6 +391,7 @@ void VISU_OpenGLPointSpriteMapper::SetPointSpriteSize( float theSize ) return; this->PointSpriteSize = theSize; + this->Modified(); } //----------------------------------------------------------------------------- @@ -398,6 +401,7 @@ void VISU_OpenGLPointSpriteMapper::SetPointSpriteMinSize( float theMinSize ) return; this->PointSpriteMinSize = theMinSize; + this->Modified(); } //----------------------------------------------------------------------------- @@ -407,6 +411,7 @@ void VISU_OpenGLPointSpriteMapper::SetPointSpriteMaxSize( float theMaxSize ) return; this->PointSpriteMaxSize = theMaxSize; + this->Modified(); } //----------------------------------------------------------------------------- @@ -416,6 +421,7 @@ void VISU_OpenGLPointSpriteMapper::SetPointSpriteMagnification( float theMagnifi return; this->PointSpriteMagnification = theMagnification; + this->Modified(); } //----------------------------------------------------------------------------- @@ -425,6 +431,7 @@ void VISU_OpenGLPointSpriteMapper::SetPointSpriteAlphaThreshold( float theAlphaT return; this->PointSpriteAlphaThreshold = theAlphaThreshold; + this->Modified(); } //----------------------------------------------------------------------------- diff --git a/src/PIPELINE/VISU_PipeLineUtils.cxx b/src/PIPELINE/VISU_PipeLineUtils.cxx index 259682e7..2223fb86 100644 --- a/src/PIPELINE/VISU_PipeLineUtils.cxx +++ b/src/PIPELINE/VISU_PipeLineUtils.cxx @@ -28,6 +28,7 @@ #include "VISU_OpenGLPointSpriteMapper.hxx" +#include #include #include @@ -245,5 +246,17 @@ namespace VISU } + //---------------------------------------------------------------------------- + bool + IsQuadraticData(vtkDataSet* theDataSet) + { + for(int i = 0, n = theDataSet->GetNumberOfCells(); i < n; i++) + if(vtkCell* aCell = theDataSet->GetCell(i)) + if(!aCell->IsLinear()) + return true; + return false; + } + + //---------------------------------------------------------------------------- } diff --git a/src/PIPELINE/VISU_PipeLineUtils.hxx b/src/PIPELINE/VISU_PipeLineUtils.hxx index d19c4667..d9d244c8 100644 --- a/src/PIPELINE/VISU_PipeLineUtils.hxx +++ b/src/PIPELINE/VISU_PipeLineUtils.hxx @@ -147,6 +147,11 @@ namespace VISU vtkFloatingPointType theDirection[3], vtkFloatingPointType thePos[3], vtkFloatingPointType& theDist); + + + //---------------------------------------------------------------------------- + bool VISU_PIPELINE_EXPORT + IsQuadraticData(vtkDataSet* theDataSet); } #endif diff --git a/src/PIPELINE/VISU_Plot3DPL.cxx b/src/PIPELINE/VISU_Plot3DPL.cxx index 8c3d9aea..adfc6ac4 100644 --- a/src/PIPELINE/VISU_Plot3DPL.cxx +++ b/src/PIPELINE/VISU_Plot3DPL.cxx @@ -196,18 +196,21 @@ void VISU_Plot3DPL ::Update() { + vtkDataSet* aMergedInput = GetMergedInput(); + if(VISU::IsQuadraticData(aMergedInput)) // Bug 0020123, note 0005343 + throw std::runtime_error("Impossible to build presentation"); + vtkFloatingPointType aPlaneNormal[3]; vtkFloatingPointType anOrigin[3]; GetBasePlane( anOrigin, aPlaneNormal ); vtkPolyData* aPolyData = 0; vtkCutter *aCutPlane = 0; - vtkDataSet* aDataSet = GetMergedInput(); if ( !IsPlanarInput() ) { aCutPlane = vtkCutter::New(); - aCutPlane->SetInput(aDataSet); + aCutPlane->SetInput(aMergedInput); vtkPlane *aPlane = vtkPlane::New(); aPlane->SetOrigin(anOrigin); @@ -221,7 +224,7 @@ VISU_Plot3DPL } if ( !aPolyData || aPolyData->GetNumberOfCells() == 0 ) { - myGeometryFilter->SetInput(aDataSet); + myGeometryFilter->SetInput(aMergedInput); aPolyData = myGeometryFilter->GetOutput(); aPolyData->Update(); } diff --git a/src/VISUGUI/VISU_msg_en.ts b/src/VISUGUI/VISU_msg_en.ts index e7539f3d..1c75f4a1 100644 --- a/src/VISUGUI/VISU_msg_en.ts +++ b/src/VISUGUI/VISU_msg_en.ts @@ -134,8 +134,8 @@ number of time stamps or number of components is not the same! Cosinusoidal ( (1 - cos(t))/2 ) - VISU_CUTLINE_PREF - CutLine preferences + VISU_CUT_LINES_PREF + Cut Lines preferences VISU_CUT_LINES @@ -3035,6 +3035,11 @@ Please, provide non-empty resulting presentation. DLG_TITLE Deformed Shape and Scalar Map + + ERR_SCALAR_DATA_INCONSISTENT + Scalar data on the selected field is inconsistent. +Please select another field. + FIELD_ITEM Scalar Field: diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 5c51442e..11011105 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -1886,7 +1886,7 @@ VisuGUI aStr == "VISU::TSCALARMAPONDEFORMEDSHAPE" || aStr == "VISU::TCOLOREDPRS3DHOLDER" || aStr == "VISU::TTABLE" || aStr == "VISU::TCURVE" || aStr == "VISU::TCONTAINER" || aStr == "VISU::POINTMAP3D" || aStr == "VISU::TVIEW3D" || - aStr == "VISU::TMESH" || aStr == "VISU::TPOINTMAP3D" || aStr == "VISU::TGAUSSPOINTS") + aStr == "VISU::TPOINTMAP3D" || aStr == "VISU::TGAUSSPOINTS") { _PTR(GenericAttribute) anAttr; if (aSObject->FindAttribute(anAttr, "AttributeName")) { @@ -2655,7 +2655,7 @@ VisuGUI tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true, this, SLOT(OnSwitchSelectionMode())); - // Defenition of the actions for the "Navigation" tool bar + // Definition of the actions for the "Navigation" tool bar registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() ); registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() ); @@ -2977,8 +2977,8 @@ VisuGUI " or ( (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent; QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})" - " or ( ((type='VISU::TTABLE' and nbChildren>0) or" - " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'})))) ) or" + aComponent; + " or ( ((type='VISU::TTABLE' and nbChildren>0) or (type='VISU::TCONTAINER' and hasCurves) or" + " (type='VISU::TCURVE')))) ) or" + aComponent; QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and (isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and isScalarBarVisible )"; QString aScalarBarShowRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and ( isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and (not isScalarBarVisible) )"; @@ -3171,18 +3171,14 @@ VisuGUI void VisuGUI::createPanels() { - myPanels.insert( SelectionPanelId, new VisuGUI_SelectionPanel( this ) ); - myPanels.insert( FeatureEdgesPanelId, new VisuGUI_FeatureEdgesPanel( this ) ); - myPanels.insert( ClippingPlanesPanelId, new VisuGUI_ClippingPanel( this ) ); - - QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end(); - for( ; it != itEnd; ++it ) - { - if( VisuGUI_Panel* aPanel = it.value() ) - { - aPanel->hide(); - GetDesktop(this)->addDockWidget( Qt::RightDockWidgetArea, aPanel ); - } + myPanels[SelectionPanelId] = new VisuGUI_SelectionPanel( this ); + myPanels[FeatureEdgesPanelId] = new VisuGUI_FeatureEdgesPanel( this ); + myPanels[ClippingPlanesPanelId] = new VisuGUI_ClippingPanel( this ); + + VisuGUI_Panel* aPanel; + foreach( aPanel, myPanels ) { + getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, aPanel ); + aPanel->setVisible( false ); } } @@ -3414,13 +3410,6 @@ VisuGUI setMenuShown( false ); setToolShown( false ); - QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end(); - for( ; it != itEnd; ++it ) - { - if( VisuGUI_Panel* aPanel = it.value() ) - aPanel->hide(); - } - // Unset actions accelerator keys action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I @@ -3682,10 +3671,10 @@ void VisuGUI::createPreferences() setPreferenceProperty( bhh, "max", 100 ); // TAB: "CutLines" - int cutLineTab = addPreference( tr( "CutLines" ) ); + int cutLineTab = addPreference( tr( "VISU_CUT_LINES" ) ); // group: "CutLines preferences" - int cutLineGr = addPreference( tr( "VISU_CUTLINE_PREF" ), cutLineTab ); + int cutLineGr = addPreference( tr( "VISU_CUT_LINES_PREF" ), cutLineTab ); setPreferenceProperty( cutLineGr, "columns", 1 ); addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" ); addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" ); diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index 3a955a50..58d8f2ce 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -218,12 +218,12 @@ private: int addVtkFontPref( const QString& label, const int pId, const QString& param, const bool useSize ); private: - QMap< PanelId, VisuGUI_Panel* > myPanels; - VisuGUI_Slider* mySlider; - VisuGUI_Sweep* mySweep; + QMap myPanels; + VisuGUI_Slider* mySlider; + VisuGUI_Sweep* mySweep; - LightApp_Displayer* myDisplayer; - VISU::TViewToPrs3d myScalarBarsMap; + LightApp_Displayer* myDisplayer; + VISU::TViewToPrs3d myScalarBarsMap; }; #endif diff --git a/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx b/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx index 210bbcdd..5a96a705 100644 --- a/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx +++ b/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx @@ -129,7 +129,7 @@ VisuGUI_BuildProgressDlg::VisuGUI_BuildProgressDlg( QWidget* theParent ): myBuildFieldsButton->setEnabled( false ); myBuildFieldsButton->setFixedSize( 30, 30 ); aPal = myBuildFieldsButton->palette(); - aPal.setColor( myBuildFieldsButton->backgroundRole(), Qt::red ); + aPal.setColor( myBuildFieldsButton->backgroundRole(), myBuildFieldsCheckBox->isChecked() ? Qt::red : Qt::gray ); myBuildFieldsButton->setPalette( aPal ); connect( myBuildFieldsCheckBox, SIGNAL( clicked() ), this, SLOT( onBuildCheckBoxClicked() ) ); @@ -140,7 +140,7 @@ VisuGUI_BuildProgressDlg::VisuGUI_BuildProgressDlg( QWidget* theParent ): myBuildMinMaxButton->setEnabled( false ); myBuildMinMaxButton->setFixedSize( 30, 30 ); aPal = myBuildMinMaxButton->palette(); - aPal.setColor( myBuildMinMaxButton->backgroundRole(), Qt::red ); + aPal.setColor( myBuildMinMaxButton->backgroundRole(), myBuildMinMaxCheckBox->isChecked() ? Qt::red : Qt::gray ); myBuildMinMaxButton->setPalette( aPal ); connect( myBuildMinMaxCheckBox, SIGNAL( clicked() ), this, SLOT( onBuildCheckBoxClicked() ) ); @@ -151,7 +151,7 @@ VisuGUI_BuildProgressDlg::VisuGUI_BuildProgressDlg( QWidget* theParent ): myBuildGroupsButton->setEnabled( false ); myBuildGroupsButton->setFixedSize( 30, 30 ); aPal = myBuildGroupsButton->palette(); - aPal.setColor( myBuildGroupsButton->backgroundRole(), Qt::red ); + aPal.setColor( myBuildGroupsButton->backgroundRole(), myBuildGroupsCheckBox->isChecked() ? Qt::red : Qt::gray ); myBuildGroupsButton->setPalette( aPal ); connect( myBuildGroupsCheckBox, SIGNAL( clicked() ), this, SLOT( onBuildCheckBoxClicked() ) ); diff --git a/src/VISUGUI/VisuGUI_ClippingPanel.cxx b/src/VISUGUI/VisuGUI_ClippingPanel.cxx index 3839330d..0b1252bd 100644 --- a/src/VISUGUI/VisuGUI_ClippingPanel.cxx +++ b/src/VISUGUI/VisuGUI_ClippingPanel.cxx @@ -208,13 +208,15 @@ CutPlaneFunction::~CutPlaneFunction() //**************************************************************** //**************************************************************** //**************************************************************** -VisuGUI_ClippingPanel::VisuGUI_ClippingPanel(VisuGUI* theModule) - : VisuGUI_Panel(tr("TITLE"), theModule, VISU::GetDesktop(theModule), ApplyBtn | HelpBtn ), - myModule(theModule), +VisuGUI_ClippingPanel::VisuGUI_ClippingPanel( VisuGUI* theModule, QWidget* theParent ) + : VisuGUI_Panel( tr( "TITLE" ), theModule, theParent, ApplyBtn | HelpBtn ), myPlaneDlg(0), myViewWindow(0), myIsApplied(true) { + setWindowTitle( tr( "TITLE" ) ); + setObjectName( tr( "TITLE" ) ); + QVBoxLayout* aMainLayout = new QVBoxLayout(mainFrame()); // List of presentations diff --git a/src/VISUGUI/VisuGUI_ClippingPanel.h b/src/VISUGUI/VisuGUI_ClippingPanel.h index 1e40755b..a3d6f004 100644 --- a/src/VISUGUI/VisuGUI_ClippingPanel.h +++ b/src/VISUGUI/VisuGUI_ClippingPanel.h @@ -115,7 +115,7 @@ class VisuGUI_ClippingPanel: public VisuGUI_Panel { Q_OBJECT public: - VisuGUI_ClippingPanel(VisuGUI* theModule); + VisuGUI_ClippingPanel(VisuGUI* theModule, QWidget* theParent = 0); ~VisuGUI_ClippingPanel(); void init(); @@ -169,8 +169,6 @@ private slots: QStringList getPrsList(_PTR(Study) theStudy, _PTR(SObject) theObject); VISU::Prs3d_i* getPrs(QString theEntry); - VisuGUI* myModule; - QListWidget* myPrsList; QTableWidget* myPlanesList; diff --git a/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx b/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx index 3d57aa32..b5415a4c 100644 --- a/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx +++ b/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.cxx @@ -71,6 +71,7 @@ VisuGUI_DeformedShapeAndScalarMapDlg::VisuGUI_DeformedShapeAndScalarMapDlg (Salo : VisuGUI_ScalarBarBaseDlg(theModule), myIsAnimation(false), myUpdateScalars(true), + myIsScalarFieldValid(true), myVisuGUI(theModule) { setWindowTitle(tr("DLG_TITLE")); @@ -136,15 +137,15 @@ VisuGUI_DeformedShapeAndScalarMapDlg::VisuGUI_DeformedShapeAndScalarMapDlg (Salo GroupButtonsLayout->setSpacing(6); GroupButtonsLayout->setMargin(11); - QPushButton* buttonOk = new QPushButton (tr("&OK"), GroupButtons); - buttonOk->setAutoDefault(true); - buttonOk->setDefault(true); + myButtonOk = new QPushButton (tr("&OK"), GroupButtons); + myButtonOk->setAutoDefault(true); + myButtonOk->setDefault(true); QPushButton* buttonCancel = new QPushButton (tr("&Cancel") , GroupButtons); buttonCancel->setAutoDefault(true); QPushButton* buttonHelp = new QPushButton (tr("&Help") , GroupButtons); buttonHelp->setAutoDefault(true); - GroupButtonsLayout->addWidget(buttonOk); + GroupButtonsLayout->addWidget(myButtonOk); GroupButtonsLayout->addSpacing(10); GroupButtonsLayout->addStretch(); GroupButtonsLayout->addWidget(buttonCancel); @@ -155,7 +156,7 @@ VisuGUI_DeformedShapeAndScalarMapDlg::VisuGUI_DeformedShapeAndScalarMapDlg (Salo TopLayout->addWidget(GroupButtons); // signals and slots connections - connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); + connect(myButtonOk, SIGNAL(clicked()), this, SLOT(accept())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp())); connect(myFieldsCombo, SIGNAL(activated(int)), this, SLOT(onFieldChanged(int))); @@ -378,7 +379,7 @@ VisuGUI_DeformedShapeAndScalarMapDlg { QApplication::setOverrideCursor(Qt::WaitCursor); - if( save_scalar_pane ) + if( save_scalar_pane && IsScalarFieldValid() ) GetScalarPane()->storeToPrsObject(myPrsCopy); QString aFieldName; @@ -390,12 +391,19 @@ VisuGUI_DeformedShapeAndScalarMapDlg VISU::Entity anEntity = getCurrentScalarEntity(); - myPrsCopy->SetScalarField(anEntity, - aFieldName.toLatin1().constData(), - theIter); - - if( save_scalar_pane ) - UpdateScalarField(); + try { + myPrsCopy->SetScalarField(anEntity, + aFieldName.toLatin1().constData(), + theIter); + if( save_scalar_pane ) + UpdateScalarField(); + myIsScalarFieldValid = true; + } catch( std::exception& exc ) { + INFOS( exc.what() ); + SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ), tr( "ERR_SCALAR_DATA_INCONSISTENT" ) ); + myIsScalarFieldValid = false; + } + updateControls(); QApplication::restoreOverrideCursor(); } @@ -461,12 +469,12 @@ void VisuGUI_DeformedShapeAndScalarMapDlg::AddAllTimes(const QString& theFieldNa void VisuGUI_DeformedShapeAndScalarMapDlg::onFieldChanged(int){ AddAllTimes(myFieldsCombo->currentText()); SetScalarField(); - UpdateScalarField(); + //UpdateScalarField(); // it is called from SetScalarField() method } void VisuGUI_DeformedShapeAndScalarMapDlg::onTimeStampChanged(int){ SetScalarField(); - UpdateScalarField(); + //UpdateScalarField(); // it is called from SetScalarField() method } void VisuGUI_DeformedShapeAndScalarMapDlg::UpdateScalarField(){ @@ -497,3 +505,12 @@ VisuGUI_DeformedShapeAndScalarMapDlg } return aTime; } + +void VisuGUI_DeformedShapeAndScalarMapDlg::updateControls() +{ + bool isScalarFieldValid = IsScalarFieldValid(); + myTabBox->setTabEnabled( 1, isScalarFieldValid ); // "Scalar Bar" tab + myTabBox->setTabEnabled( 2, isScalarFieldValid ); // "Input" tab + myTimeStampsCombo->setEnabled( isScalarFieldValid ); + myButtonOk->setEnabled( isScalarFieldValid ); +} diff --git a/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.h b/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.h index c8d53ef3..51dfa3f3 100644 --- a/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.h +++ b/src/VISUGUI/VisuGUI_DeformedShapeAndScalarMapDlg.h @@ -69,6 +69,8 @@ public: VISU::Entity getCurrentScalarEntity(); void SetScalarField(int theIter,QString theFieldName=QString(""), const bool = true ); + bool IsScalarFieldValid() const { return myIsScalarFieldValid; } + protected: virtual QString GetContextHelpFilePath(); @@ -87,6 +89,7 @@ private: VisuGUI_InputPane* myInputPane; QComboBox *myFieldsCombo; QComboBox *myTimeStampsCombo; + QPushButton* myButtonOk; typedef std::map TTimeStampNumber2Time; // Times map definition (iteration time, real value of time) typedef std::map TFieldName2TimeStamps; // Field name and enity to Times @@ -101,6 +104,8 @@ private: _PTR(SObject) mySelectionObj; SALOME::GenericObjPtr myPrsCopy; SalomeApp_Module* myVisuGUI; + + bool myIsScalarFieldValid; protected: void UpdateScalarField(); @@ -110,6 +115,7 @@ protected: QString GetFloatValueOfTimeStamp(VISU::Entity theEntity, const std::string& theFieldName, int theTimeStampNumber); + void updateControls(); }; #endif // VISUGUI_DEFORMEDSHAPEDLS_H diff --git a/src/VISUGUI/VisuGUI_FeatureEdgesPanel.cxx b/src/VISUGUI/VisuGUI_FeatureEdgesPanel.cxx index fc7f1929..7162c691 100644 --- a/src/VISUGUI/VisuGUI_FeatureEdgesPanel.cxx +++ b/src/VISUGUI/VisuGUI_FeatureEdgesPanel.cxx @@ -47,10 +47,13 @@ #include -VisuGUI_FeatureEdgesPanel::VisuGUI_FeatureEdgesPanel( const VisuGUI* theModule, QWidget* theParent ) : +VisuGUI_FeatureEdgesPanel::VisuGUI_FeatureEdgesPanel( VisuGUI* theModule, QWidget* theParent ) : VisuGUI_Panel( tr( "WINDOW_TITLE" ), theModule, theParent, ApplyBtn | CloseBtn | HelpBtn ), myActor( 0 ) { + setWindowTitle( tr( "WINDOW_TITLE" ) ); + setObjectName( tr( "WINDOW_TITLE" ) ); + QVBoxLayout* aTopLayout = new QVBoxLayout( mainFrame() ); myGrp = new QGroupBox( tr( "FEATURE_EDGES_PROPERTIES" ), mainFrame() ); @@ -77,10 +80,8 @@ VisuGUI_FeatureEdgesPanel::VisuGUI_FeatureEdgesPanel( const VisuGUI* theModule, aTopLayout->addWidget( myGrp ); - SalomeApp_Application* anApp = - dynamic_cast( SUIT_Session::session()->activeApplication() ); - LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr(); - connect( aSelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionEvent() ) ); + connect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( onSelectionEvent() ) ); } VisuGUI_FeatureEdgesPanel::~VisuGUI_FeatureEdgesPanel() @@ -148,7 +149,7 @@ void VisuGUI_FeatureEdgesPanel::onSelectionEvent() anIsManifoldEdges, anIsNonManifoldEdges ); - float aColoring = myActor->GetFeatureEdgesColoring(); + //float aColoring = myActor->GetFeatureEdgesColoring(); myAngleSpinBox->setValue( anAngle ); myFeatureEdgesCB->setChecked( anIsFeatureEdges ); @@ -176,7 +177,7 @@ void VisuGUI_FeatureEdgesPanel::onApply() void VisuGUI_FeatureEdgesPanel::onClose() { - close(); + // hide(); VisuGUI_Panel::onClose(); } @@ -213,3 +214,19 @@ void VisuGUI_FeatureEdgesPanel::keyPressEvent( QKeyEvent* e ) onHelp(); } } + +void VisuGUI_FeatureEdgesPanel::onModuleActivated() +{ + disconnect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( onSelectionEvent() ) ); + connect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( onSelectionEvent() ) ); + VisuGUI_Panel::onModuleActivated(); +} + +void VisuGUI_FeatureEdgesPanel::onModuleDeactivated() +{ + disconnect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( onSelectionEvent() ) ); + VisuGUI_Panel::onModuleDeactivated(); +} diff --git a/src/VISUGUI/VisuGUI_FeatureEdgesPanel.h b/src/VISUGUI/VisuGUI_FeatureEdgesPanel.h index 6e36dd83..504d24eb 100644 --- a/src/VISUGUI/VisuGUI_FeatureEdgesPanel.h +++ b/src/VISUGUI/VisuGUI_FeatureEdgesPanel.h @@ -41,13 +41,17 @@ class VisuGUI_FeatureEdgesPanel: public VisuGUI_Panel Q_OBJECT public: - VisuGUI_FeatureEdgesPanel( const VisuGUI* theModule, QWidget* theParent = 0 ); + VisuGUI_FeatureEdgesPanel( VisuGUI* theModule, QWidget* theParent = 0 ); virtual ~VisuGUI_FeatureEdgesPanel (); protected: virtual void keyPressEvent( QKeyEvent* theEvent ); virtual void showEvent( QShowEvent* theEvent ); +protected slots: + virtual void onModuleActivated(); + virtual void onModuleDeactivated(); + private slots: virtual void onApply(); virtual void onClose(); diff --git a/src/VISUGUI/VisuGUI_Panel.cxx b/src/VISUGUI/VisuGUI_Panel.cxx index c1be4ea0..bf02fc76 100755 --- a/src/VISUGUI/VisuGUI_Panel.cxx +++ b/src/VISUGUI/VisuGUI_Panel.cxx @@ -43,7 +43,7 @@ \brief Frame inserted in viewport with redefined sizeHint method in order to avoid unreasonable increasing of viewport size */ -class VisuGUI_Panel::MainFrame : public QFrame +class VisuGUI_Panel::MainFrame : public QWidget { public: /*! @@ -51,7 +51,7 @@ public: \param theParent parent widget */ MainFrame( QWidget* theParent = 0 ) - : QFrame( theParent ) + : QWidget( theParent ) { } @@ -77,29 +77,33 @@ public: /*! \brief Constructor creates panels look and feel - \param theName name of the panel + \param theName panel title + \param theModule parent VISU GUI module \param theParent parent widget + \param theBtns panel buttons */ -VisuGUI_Panel::VisuGUI_Panel( const QString& theName, - const VisuGUI* theModule, - QWidget* theParent, - const int theBtns ) - : QtxDockWidget( theName, theParent ), +VisuGUI_Panel::VisuGUI_Panel( const QString& theName, + VisuGUI* theModule, + QWidget* theParent, + const int theBtns ) + : QtxDockWidget( true, theParent ), myModule( theModule ), myOK( 0 ), myApply( 0 ), myClose( 0 ), myHelp( 0 ) { + setObjectName( theName ); + QWidget* aGrp = new QWidget( this ); setWidget( aGrp ); // Create scroll view myView = new QScrollArea( aGrp ); + myView->setFrameStyle( QFrame::Plain | QFrame::NoFrame ); // Create main frame myMainFrame = new MainFrame( myView ); - myMainFrame->setFrameStyle( QFrame::Plain | QFrame::NoFrame ); myView->setWidget( myMainFrame ); myView->setAlignment( Qt::AlignCenter ); @@ -107,32 +111,32 @@ VisuGUI_Panel::VisuGUI_Panel( const QString& theName, myView->setMinimumWidth( myMainFrame->sizeHint().width() + 22 ); // Create buttons - QWidget* aBtnWg = new QWidget( aGrp ); - QHBoxLayout* aBtnWgLayout = new QHBoxLayout( aBtnWg ); + QHBoxLayout* aBtnWgLayout = new QHBoxLayout; + aBtnWgLayout->setMargin( 0 ); aBtnWgLayout->addStretch(); if( theBtns & OKBtn ) { - myOK = new QPushButton( tr( "BUT_OK" ), aBtnWg ); + myOK = new QPushButton( tr( "BUT_OK" ), aGrp ); aBtnWgLayout->addWidget( myOK ); connect( myOK, SIGNAL( clicked() ), SLOT( onOK() ) ); } if( theBtns & ApplyBtn ) { - myApply = new QPushButton( tr( "BUT_APPLY" ), aBtnWg ); + myApply = new QPushButton( tr( "BUT_APPLY" ), aGrp ); aBtnWgLayout->addWidget( myApply ); connect( myApply, SIGNAL( clicked() ), SLOT( onApply() ) ); } if( theBtns & CloseBtn ) { - myClose = new QPushButton( tr( "BUT_CLOSE" ), aBtnWg ); + myClose = new QPushButton( tr( "BUT_CLOSE" ), aGrp ); aBtnWgLayout->addWidget( myClose ); connect( myClose, SIGNAL( clicked() ), SLOT( onClose() ) ); } if( theBtns & HelpBtn ) { - myHelp = new QPushButton( tr( "BUT_HELP" ), aBtnWg ); + myHelp = new QPushButton( tr( "BUT_HELP" ), aGrp ); aBtnWgLayout->addWidget( myHelp ); connect( myHelp, SIGNAL( clicked() ), SLOT( onHelp() ) ); } @@ -141,9 +145,12 @@ VisuGUI_Panel::VisuGUI_Panel( const QString& theName, // fill layout QVBoxLayout* aLay = new QVBoxLayout( aGrp ); - aLay->setContentsMargins( 0, 0, 0, 0 ); + aLay->setMargin( 2 ); aLay->addWidget( myView, 1 ); - aLay->addWidget( aBtnWg ); + aLay->addLayout( aBtnWgLayout ); + + connect( theModule, SIGNAL( moduleDeactivated() ), SLOT( onModuleDeactivated() ) ); + connect( theModule, SIGNAL( moduleActivated() ), SLOT( onModuleActivated() ) ); } /*! @@ -218,6 +225,7 @@ void VisuGUI_Panel::onClose() { if ( myClose ) myClose->setFocus(); + hide(); } /*! @@ -235,7 +243,17 @@ void VisuGUI_Panel::onHelp() panels should use it as parent \return QFrame* object */ -QFrame* VisuGUI_Panel::mainFrame() +QWidget* VisuGUI_Panel::mainFrame() { return myMainFrame; } + +void VisuGUI_Panel::onModuleActivated() +{ + widget()->setHidden( false ); +} + +void VisuGUI_Panel::onModuleDeactivated() +{ + widget()->setHidden( true ); +} diff --git a/src/VISUGUI/VisuGUI_Panel.h b/src/VISUGUI/VisuGUI_Panel.h index a3336c9b..05f33c80 100755 --- a/src/VISUGUI/VisuGUI_Panel.h +++ b/src/VISUGUI/VisuGUI_Panel.h @@ -29,7 +29,6 @@ #include -class QFrame; class QScrollArea; class QPushButton; @@ -51,9 +50,9 @@ public: public: VisuGUI_Panel( const QString& theName, - const VisuGUI* theModule, - QWidget* theParent, - const int theBtns = AllBtn ); + VisuGUI* theModule, + QWidget* theParent = 0, + const int theBtns = AllBtn ); virtual ~VisuGUI_Panel(); virtual bool isValid( QString& theMessage ); @@ -65,19 +64,22 @@ protected slots: virtual void onClose(); virtual void onHelp(); + virtual void onModuleActivated(); + virtual void onModuleDeactivated(); + protected: - QFrame* mainFrame(); + QWidget* mainFrame(); protected: QScrollArea* myView; - QFrame* myMainFrame; + QWidget* myMainFrame; QPushButton* myOK; QPushButton* myApply; QPushButton* myClose; QPushButton* myHelp; - const VisuGUI* myModule; + VisuGUI* myModule; }; #endif diff --git a/src/VISUGUI/VisuGUI_SelectionPanel.cxx b/src/VISUGUI/VisuGUI_SelectionPanel.cxx index cb8531a3..f0dc15d2 100644 --- a/src/VISUGUI/VisuGUI_SelectionPanel.cxx +++ b/src/VISUGUI/VisuGUI_SelectionPanel.cxx @@ -122,10 +122,13 @@ public: } }; -VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const VisuGUI* theModule, QWidget* theParent ) : - VisuGUI_Panel( tr("WINDOW_TITLE" ), theModule, theParent, CloseBtn | HelpBtn ), +VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( VisuGUI* theModule, QWidget* theParent ) : + VisuGUI_Panel( tr( "WINDOW_TITLE" ), theModule, theParent, CloseBtn | HelpBtn ), myPreferencesDlg( 0 ) { + setWindowTitle( tr( "WINDOW_TITLE" ) ); + setObjectName( tr( "WINDOW_TITLE" ) ); + QVBoxLayout* TopLayout = new QVBoxLayout ( mainFrame() ); QWidget* aNamePane = new QWidget (mainFrame()); @@ -335,10 +338,8 @@ VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const VisuGUI* theModule, QWidge TopLayout->addWidget( aPrefBtn ); - SalomeApp_Application* anApp = - dynamic_cast( SUIT_Session::session()->activeApplication() ); - LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr(); - connect( aSelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionEvent() ) ); + connect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( onSelectionEvent() ) ); connect( this, SIGNAL( selectionModeChanged( int ) ), myModule, SLOT( OnSwitchSelectionMode( int ) ) ); @@ -450,7 +451,7 @@ void VisuGUI_SelectionPanel::showEvent( QShowEvent* theEvent ) void VisuGUI_SelectionPanel::closeEvent( QCloseEvent* theEvent ) { - onClose(); + //onClose(); VisuGUI_Panel::closeEvent(theEvent); } @@ -518,7 +519,7 @@ void VisuGUI_SelectionPanel::onSelectionEvent() { case GaussPointSelection: break; default: - close(); + hide(); return; } @@ -1091,7 +1092,7 @@ void VisuGUI_SelectionPanel::onApply() void VisuGUI_SelectionPanel::onClose() { - close(); + //hide(); VisuGUI_Panel::onClose(); } @@ -1128,3 +1129,19 @@ void VisuGUI_SelectionPanel::keyPressEvent( QKeyEvent* e ) onHelp(); } } + +void VisuGUI_SelectionPanel::onModuleActivated() +{ + disconnect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( onSelectionEvent() ) ); + connect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( onSelectionEvent() ) ); + VisuGUI_Panel::onModuleActivated(); +} + +void VisuGUI_SelectionPanel::onModuleDeactivated() +{ + disconnect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), + this, SLOT( onSelectionEvent() ) ); + VisuGUI_Panel::onModuleDeactivated(); +} diff --git a/src/VISUGUI/VisuGUI_SelectionPanel.h b/src/VISUGUI/VisuGUI_SelectionPanel.h index c903e454..324ce098 100644 --- a/src/VISUGUI/VisuGUI_SelectionPanel.h +++ b/src/VISUGUI/VisuGUI_SelectionPanel.h @@ -92,12 +92,16 @@ class VisuGUI_SelectionPanel: public VisuGUI_Panel enum ColumnId { Cell = 0, Point, X, Y, Z, I, J, K, Scalar, Vector }; public: - VisuGUI_SelectionPanel( const VisuGUI* theModule, QWidget* theParent = 0 ); + VisuGUI_SelectionPanel( VisuGUI* theModule, QWidget* theParent = 0 ); virtual ~VisuGUI_SelectionPanel (); public: void setSelectionMode( int theId ); +protected slots: + virtual void onModuleActivated(); + virtual void onModuleDeactivated(); + protected: virtual void keyPressEvent( QKeyEvent* theEvent ); virtual void showEvent( QShowEvent* theEvent ); diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index 326bac71..68bd2e2b 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -1927,25 +1927,28 @@ void VisuGUI_TimeAnimationDlg::onPlayPressed() //------------------------------------------------------------------------ void VisuGUI_TimeAnimationDlg::onBackPressed() { - //stopAnimation(); + stopAnimation(); myAnimator->prevFrame(); } //------------------------------------------------------------------------ void VisuGUI_TimeAnimationDlg::onForvardPressed() { + stopAnimation(); myAnimator->nextFrame(); } //------------------------------------------------------------------------ void VisuGUI_TimeAnimationDlg::onLastPressed() { + stopAnimation(); myAnimator->lastFrame(); } //------------------------------------------------------------------------ void VisuGUI_TimeAnimationDlg::onFirstPressed() { + stopAnimation(); myAnimator->firstFrame(); } diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 9d150f1b..0060ee78 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -86,38 +86,36 @@ namespace VISU SUIT_Desktop* GetDesktop(const CAM_Module* theModule) { - return theModule->application()->desktop(); + return theModule && theModule->application() ? theModule->application()->desktop() : 0; } //------------------------------------------------------------ LightApp_SelectionMgr* GetSelectionMgr(const SalomeApp_Module* theModule) { - return theModule->getApp()->selectionMgr(); + return theModule && theModule->getApp() ? theModule->getApp()->selectionMgr() : 0; } //------------------------------------------------------------ SalomeApp_Study* GetAppStudy(const CAM_Module* theModule) { - return - dynamic_cast(theModule->application()->activeStudy()); + return theModule && theModule->application() ? + dynamic_cast(theModule->application()->activeStudy()) : 0; } //------------------------------------------------------------ _PTR(Study) GetCStudy(const SalomeApp_Study* theStudy) { - return theStudy->studyDS(); + return theStudy ? theStudy->studyDS() : _PTR(Study)(); } //------------------------------------------------------------ bool IsStudyLocked( _PTR(Study) theStudy ) { - if( theStudy ) - return theStudy->GetProperties()->IsLocked(); - return true; + return theStudy ? theStudy->GetProperties()->IsLocked() : true; } //------------------------------------------------------------ @@ -256,23 +254,25 @@ namespace VISU TSelectionInfo aSelectionInfo; const SalomeApp_Study* aStudy = GetAppStudy(theModule); LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule); - SALOME_ListIO aListIO; - aSelectionMgr->selectedObjects(aListIO); - SALOME_ListIteratorOfListIO anIter(aListIO); - while(anIter.More()) - { - Handle(SALOME_InteractiveObject) anIO = anIter.Value(); - if(anIO->hasEntry()) + if ( aStudy && aSelectionMgr ) { + SALOME_ListIO aListIO; + aSelectionMgr->selectedObjects(aListIO); + SALOME_ListIteratorOfListIO anIter(aListIO); + while(anIter.More()) { - TObjectInfo anObjectInfo = GetObjectByEntry(aStudy, anIO->getEntry()); - if(anObjectInfo.mySObject){ - TSelectionItem aSelectionItem; - aSelectionItem.myObjectInfo = anObjectInfo; - aSelectionItem.myIO = anIO; - aSelectionInfo.push_back(aSelectionItem); + Handle(SALOME_InteractiveObject) anIO = anIter.Value(); + if(anIO->hasEntry()) + { + TObjectInfo anObjectInfo = GetObjectByEntry(aStudy, anIO->getEntry()); + if(anObjectInfo.mySObject){ + TSelectionItem aSelectionItem; + aSelectionItem.myObjectInfo = anObjectInfo; + aSelectionItem.myIO = anIO; + aSelectionInfo.push_back(aSelectionItem); + } } + anIter.Next(); // MULTIPR fixed } - anIter.Next(); // MULTIPR fixed } return aSelectionInfo; } diff --git a/src/VISU_I/VISU_GaussPoints_i.cc b/src/VISU_I/VISU_GaussPoints_i.cc index 050e768d..675982f3 100644 --- a/src/VISU_I/VISU_GaussPoints_i.cc +++ b/src/VISU_I/VISU_GaussPoints_i.cc @@ -1012,7 +1012,7 @@ VISU::GaussPoints_i myColor.blue() / 255.0); } - anActor->SetBarVisibility(myShowBar); + anActor->SetBarVisibility(myShowBar && GetIsColored()); if( GetSpecificPL()->GetPrimitiveType() != VISU_OpenGLPointSpriteMapper::GeomSphere ) theActor->SetRepresentation( VTK_POINTS ); diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 3ec20db4..7b010add 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -545,6 +545,7 @@ VISU::Prs3d_i if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "<