From 95669aa296012d642a6148ed9bf6942a769f73bd Mon Sep 17 00:00:00 2001 From: rnv Date: Mon, 23 Jun 2008 10:48:36 +0000 Subject: [PATCH] Fix for IPAL19945 (Damage of gauss scene with selection info) --- src/OBJECT/VISU_GaussPtsAct.cxx | 37 ++++++++------ src/OBJECT/VISU_GaussPtsSettings.cxx | 47 +++++++++++++----- src/OBJECT/VISU_GaussPtsSettings.h | 4 -- src/VVTK/VVTK_PickingDlg.cxx | 73 +++++----------------------- 4 files changed, 69 insertions(+), 92 deletions(-) diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index b75073e3..67cc2d8f 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -964,20 +964,9 @@ VISU_GaussPtsAct myOutlineActor->SetVisibility(false); myCursorPyramid->SetVisibility(false); - - myTextActor->SetVisibility(anIsVisible); - myCellActor->SetVisibility(anIsVisible); - GetScalarBarCtrl()->SetIsMarked(anIsVisible); - myCursorPyramidSelected->SetVisibility(anIsVisible); -//GetScalarBarCtrl()->Update(); - - myIsHighlighted = aCurrentHasIndex; - - // Zoom if necessary - ChangeZoom(myPickingSettings, - GetRenderer(), - anInitialHasIndex, - aCurrentHasIndex); + myTextActor->SetVisibility(false); + myCellActor->SetVisibility(false); + myCursorPyramidSelected->SetVisibility(false); if(!theIsHighlight) return; @@ -986,13 +975,27 @@ VISU_GaussPtsAct Superclass::highlight(theIsHighlight); return; } - + if( aSelectionMode != GaussPointSelection ) return; if ( !aCurrentHasIndex || !myBarVisibility ) return; + myTextActor->SetVisibility(anIsVisible); + myCellActor->SetVisibility(anIsVisible && myPickingSettings->GetDisplayParentMesh()); + GetScalarBarCtrl()->SetIsMarked(anIsVisible); + myCursorPyramidSelected->SetVisibility(anIsVisible); +//GetScalarBarCtrl()->Update(); + + myIsHighlighted = aCurrentHasIndex; + + // Zoom if necessary + ChangeZoom(myPickingSettings, + GetRenderer(), + anInitialHasIndex, + aCurrentHasIndex); + // TColStd_IndexedMapOfInteger aMapIndex; mySelector->GetIndex( getIO(), aMapIndex ); if(aMapIndex.Extent() != 1 || !myBarVisibility) { @@ -1128,6 +1131,8 @@ VISU_GaussPtsAct myCellActor->SetVisibility(anIsVisible && theIsHighlight); myCellActor->SetRepresentation(VTK_WIREFRAME); } + else + myCellActor->SetVisibility(false); } } @@ -1158,7 +1163,7 @@ void VISU_GaussPtsAct ::UpdatePickingSettings() { - if(!myPickingSettings || myPickingSettings->GetInitial()) + if(!myPickingSettings) return; myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition()); diff --git a/src/OBJECT/VISU_GaussPtsSettings.cxx b/src/OBJECT/VISU_GaussPtsSettings.cxx index e1c59248..51561368 100644 --- a/src/OBJECT/VISU_GaussPtsSettings.cxx +++ b/src/OBJECT/VISU_GaussPtsSettings.cxx @@ -27,10 +27,14 @@ // $Header$ #include "VISU_GaussPtsSettings.h" +#include "SUIT_ResourceMgr.h" +#include "SUIT_Session.h" #include #include +#include "qcolor.h" + //---------------------------------------------------------------- vtkStandardNewMacro( VISU_GaussPtsSettings ); vtkStandardNewMacro( VISU_InsideCursorSettings ); @@ -86,19 +90,38 @@ VISU_OutsideCursorSettings::~VISU_OutsideCursorSettings() //---------------------------------------------------------------- VISU_PickingSettings::VISU_PickingSettings() { - this->Initial = true; + float aCursorSize = 0.5; + float aPyramidHeight = 10.0; + float aPointTolerance = 0.1; + QColor aColor = Qt::yellow; + int anInfoWindowTransparency = 50; + int anInfoWindowPosition = VISU_PickingSettings::BelowPoint; + float aZoomFactor = 1.5; + int aStepNumber = 10; + bool aDisplayParentMesh = false; + + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); - this->PyramidHeight = -1; - this->CursorSize = -1; - this->PointTolerance = -1; - this->Color[0] = -1; - this->Color[1] = -1; - this->Color[2] = -1; - this->InfoWindowTransparency = -1; - this->InfoWindowPosition = -1; - this->ZoomFactor = -1; - this->StepNumber = -1; - this->DisplayParentMesh = false; + this->CursorSize = aResourceMgr->doubleValue( "VISU", "picking_cursor_size", aCursorSize ); + + this->PyramidHeight = aResourceMgr->doubleValue( "VISU", "picking_pyramid_height", aPyramidHeight ); + + this->PointTolerance = aResourceMgr->doubleValue( "VISU", "picking_point_tolerance", aPointTolerance ); + + aColor = aResourceMgr->colorValue( "VISU", "picking_selection_color", aColor ); + this->Color[0] = aColor.red() / 255.0; + this->Color[1] = aColor.green() / 255.0; + this->Color[2] = aColor.blue() / 255.0; + + this->InfoWindowTransparency = aResourceMgr->integerValue( "VISU", "picking_transparency", anInfoWindowTransparency ) / 100.0; + + this->InfoWindowPosition = aResourceMgr->integerValue( "VISU", "picking_position", anInfoWindowPosition ); + + this->ZoomFactor = aResourceMgr->doubleValue( "VISU", "picking_zoom_factor", aZoomFactor ); + + this->StepNumber = aResourceMgr->integerValue( "VISU", "picking_step_number", aStepNumber ); + + this->DisplayParentMesh = aResourceMgr->booleanValue( "VISU", "picking_display_parent_mesh", aDisplayParentMesh ); } VISU_PickingSettings::~VISU_PickingSettings() diff --git a/src/OBJECT/VISU_GaussPtsSettings.h b/src/OBJECT/VISU_GaussPtsSettings.h index 473ddd10..33b9f48a 100644 --- a/src/OBJECT/VISU_GaussPtsSettings.h +++ b/src/OBJECT/VISU_GaussPtsSettings.h @@ -186,9 +186,6 @@ class VTKOCC_EXPORT VISU_PickingSettings : public vtkObject VISU_PickingSettings* New(); - vtkSetMacro( Initial, bool ); - vtkGetMacro( Initial, bool ); - vtkSetMacro( PyramidHeight, vtkFloatingPointType ); vtkGetMacro( PyramidHeight, vtkFloatingPointType ); @@ -217,7 +214,6 @@ class VTKOCC_EXPORT VISU_PickingSettings : public vtkObject vtkGetMacro( DisplayParentMesh, bool ); private: - bool Initial; vtkFloatingPointType PyramidHeight; vtkFloatingPointType CursorSize; diff --git a/src/VVTK/VVTK_PickingDlg.cxx b/src/VVTK/VVTK_PickingDlg.cxx index 817c6e9e..65af6b58 100644 --- a/src/VVTK/VVTK_PickingDlg.cxx +++ b/src/VVTK/VVTK_PickingDlg.cxx @@ -443,64 +443,19 @@ void VVTK_PickingDlg::RemoveActor( VISU_GaussPtsAct* theActor ) void VVTK_PickingDlg::Update() { - float aCursorSize = 0.5; - float aPyramidHeight = 10.0; - float aPointTolerance = 0.1; - QColor aColor = Qt::yellow; - int anInfoWindowTransparency = 50; - int anInfoWindowPosition = VISU_PickingSettings::BelowPoint; - float aZoomFactor = 1.5; - int aStepNumber = 10; - bool aDisplayParentMesh = false; - - if( !myPickingSettings->GetInitial() ) - { - myCursorSizeSpinBox->setValue( myPickingSettings->GetCursorSize() ); - myPyramidHeightSpinBox->setValue( myPickingSettings->GetPyramidHeight() ); - myPointToleranceSpinBox->setValue( myPickingSettings->GetPointTolerance() ); - myTransparencySpinBox->setValue( int(myPickingSettings->GetInfoWindowTransparency() * 100.0) ); - myPositionComboBox->setCurrentItem( myPickingSettings->GetInfoWindowPosition() ); - myZoomFactorSpinBox->setValue( myPickingSettings->GetZoomFactor() ); - myStepNumberSpinBox->setValue( myPickingSettings->GetStepNumber() ); - myDisplayParentMeshCheckBox->setChecked( myPickingSettings->GetDisplayParentMesh() ); - - vtkFloatingPointType* aColor = myPickingSettings->GetColor(); - mySelectionColorButton->setPaletteBackgroundColor( QColor( ( int )( aColor[0] * 255.0 ), - ( int )( aColor[1] * 255.0 ), - ( int )( aColor[2] * 255.0 ) ) ); - - return; - } - - SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); - - aCursorSize = aResourceMgr->doubleValue( "VISU", "picking_cursor_size", aCursorSize ); - myCursorSizeSpinBox->setValue( aCursorSize ); - - aPyramidHeight = aResourceMgr->doubleValue( "VISU", "picking_pyramid_height", aPyramidHeight ); - myPyramidHeightSpinBox->setValue( aPyramidHeight ); - - aPointTolerance = aResourceMgr->doubleValue( "VISU", "picking_point_tolerance", aPointTolerance ); - myPointToleranceSpinBox->setValue( aPointTolerance ); - - aColor = aResourceMgr->colorValue( "VISU", "picking_selection_color", aColor ); - mySelectionColorButton->setPaletteBackgroundColor( aColor ); - - anInfoWindowTransparency = aResourceMgr->integerValue( "VISU", "picking_transparency", anInfoWindowTransparency ); - myTransparencySpinBox->setValue( anInfoWindowTransparency ); - - anInfoWindowPosition = aResourceMgr->integerValue( "VISU", "picking_position", anInfoWindowPosition ); - myPositionComboBox->setCurrentItem( anInfoWindowPosition ); - - aZoomFactor = aResourceMgr->doubleValue( "VISU", "picking_zoom_factor", aZoomFactor ); - myZoomFactorSpinBox->setValue( aZoomFactor ); - - aStepNumber = aResourceMgr->integerValue( "VISU", "picking_step_number", aStepNumber ); - myStepNumberSpinBox->setValue( aStepNumber ); - - aDisplayParentMesh = aResourceMgr->booleanValue( "VISU", "picking_display_parent_mesh", aDisplayParentMesh ); - myDisplayParentMeshCheckBox->setChecked( aDisplayParentMesh ); - + myCursorSizeSpinBox->setValue( myPickingSettings->GetCursorSize() ); + myPyramidHeightSpinBox->setValue( myPickingSettings->GetPyramidHeight() ); + myPointToleranceSpinBox->setValue( myPickingSettings->GetPointTolerance() ); + myTransparencySpinBox->setValue( int(myPickingSettings->GetInfoWindowTransparency() * 100.0) ); + myPositionComboBox->setCurrentItem( myPickingSettings->GetInfoWindowPosition() ); + myZoomFactorSpinBox->setValue( myPickingSettings->GetZoomFactor() ); + myStepNumberSpinBox->setValue( myPickingSettings->GetStepNumber() ); + myDisplayParentMeshCheckBox->setChecked( myPickingSettings->GetDisplayParentMesh() ); + + vtkFloatingPointType* aColor = myPickingSettings->GetColor(); + mySelectionColorButton->setPaletteBackgroundColor( QColor( ( int )( aColor[0] * 255.0 ), + ( int )( aColor[1] * 255.0 ), + ( int )( aColor[2] * 255.0 ) ) ); onClickApply(); } @@ -590,8 +545,6 @@ void VVTK_PickingDlg::KeyPressed() void VVTK_PickingDlg::onClickApply() { - myPickingSettings->SetInitial( false ); - myPickingSettings->SetCursorSize( myCursorSizeSpinBox->value() ); myPickingSettings->SetPyramidHeight( myPyramidHeightSpinBox->value() ); myPickingSettings->SetPointTolerance( myPointToleranceSpinBox->value() ); -- 2.39.2