]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for IPAL19945 (Damage of gauss scene with selection info) V4_1_0_maintainance_20080624
authorrnv <rnv@opencascade.com>
Mon, 23 Jun 2008 10:48:36 +0000 (10:48 +0000)
committerrnv <rnv@opencascade.com>
Mon, 23 Jun 2008 10:48:36 +0000 (10:48 +0000)
src/OBJECT/VISU_GaussPtsAct.cxx
src/OBJECT/VISU_GaussPtsSettings.cxx
src/OBJECT/VISU_GaussPtsSettings.h
src/VVTK/VVTK_PickingDlg.cxx

index b75073e39cbd353f97008f0b888f41d12a91eecf..67cc2d8f2db382ff38444a4b5f340c7805904f2c 100644 (file)
@@ -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());
index e1c592481080ec5d5b362df1dcd3b707bde2de84..51561368f69870091ff6c0132cf4823c7cd2bbd0 100644 (file)
 //  $Header$
 
 #include "VISU_GaussPtsSettings.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
 
 #include <vtkObjectFactory.h>
 #include <vtkImageData.h>
 
+#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()
index 473ddd103d5420e616005110bd3dffb77939a52f..33b9f48ab55a40af3d1062db6342cc8631556a60 100644 (file)
@@ -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;
index 817c6e9ee94d93ae49b319b2d1dac88fa241ac16..65af6b581f509e02961d69735e059f88c00dc7f2 100644 (file)
@@ -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() );