From: ouv Date: Wed, 28 May 2008 08:52:54 +0000 (+0000) Subject: VISU 2008 - Unification of the VISU selection functionality (debug) X-Git-Tag: TG_VISU_2008_2008-06-26~36 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bdd06d1a0e6616544f839253c5e43585189ca868;p=modules%2Fvisu.git VISU 2008 - Unification of the VISU selection functionality (debug) --- diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index 58c84091..79a3a7ae 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -541,7 +541,7 @@ ChangeZoom(vtkFloatingPointType theZoomFactor, aCamera->SetParallelScale( aScale / theZoomFactor ); } else { - //printf( " - +%f", theZoomFactor ); + //printf( " : -%f", theZoomFactor ); aCamera->SetParallelScale( aScale * theZoomFactor ); } } @@ -555,10 +555,9 @@ void VISU_Actor ::highlight(bool theIsHighlight) { - //printf( "VISU_Actor::highlight( %d )\n", (int)theIsHighlight ); VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get(); - bool aShowTextActor = /*aPickingSettings->GetIsActive() && */aPickingSettings->GetInfoWindowEnabled(); + bool aShowTextActor = aPickingSettings->GetInfoWindowEnabled(); if( theIsHighlight && mySelectionMode != myLastSelectionMode ) { if( mySelectionMode == ActorSelection ) @@ -729,10 +728,17 @@ VISU_Actor SVTK_SelectionEvent* theSelectionEvent, bool theIsHighlight) { - //printf( "VISU_Actor::Highlight( %d )\n", (int)theIsHighlight ); - bool aRet = Superclass::Highlight(theInteractorStyle, - theSelectionEvent, - theIsHighlight); + return Superclass::Highlight(theInteractorStyle, + theSelectionEvent, + theIsHighlight); +} + +//------------------------------------------------------------------------- +void +VISU_Actor +::Highlight(bool theIsHighlight) +{ + Superclass::Highlight(theIsHighlight); VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get(); @@ -742,44 +748,41 @@ VISU_Actor mySelector->GetIndex( getIO(), aMapIndex ); bool aCurrentHasIndex = aMapIndex.Extent() == 1; - myIsSubElementsHighlighted = theIsHighlight ? aCurrentHasIndex : false; + myIsSubElementsHighlighted = aCurrentHasIndex; + bool aFlyTo = false; vtkFloatingPointType aFlyToCoord[3] = { 0.0, 0.0, 0.0 }; - vtkRenderer* aRenderer = theInteractorStyle->GetCurrentRenderer(); + vtkRenderer *aRenderer = GetRenderer(); - if(theIsHighlight){ + if( theIsHighlight ) + { vtkDataSet* aDataSet = GetMapper()->GetInput(); - switch(mySelectionMode){ - case ActorSelection:{ - vtkFloatingPointType aCoord[6]; - GetBounds(aCoord); + switch(mySelectionMode) + { + case ActorSelection: + { + vtkFloatingPointType aCoord[6]; + GetBounds(aCoord); - aFlyToCoord[0] = ( aCoord[0] + aCoord[1] ) / 2; - aFlyToCoord[1] = ( aCoord[2] + aCoord[3] ) / 2; - aFlyToCoord[2] = ( aCoord[4] + aCoord[5] ) / 2; + aFlyTo = true; + aFlyToCoord[0] = ( aCoord[0] + aCoord[1] ) / 2; + aFlyToCoord[1] = ( aCoord[2] + aCoord[3] ) / 2; + aFlyToCoord[2] = ( aCoord[4] + aCoord[5] ) / 2; - ResetTextActor(); + ResetTextActor(); - aRet = true; - break; - } - case CellSelection:{ - myCellPicker->Pick(theSelectionEvent->myX, - theSelectionEvent->myY, - 0.0, - aRenderer); - - if(myCellPicker->GetActor() != this) - { - aRet = false; break; } + case CellSelection: + { + if( !aCurrentHasIndex ) + { + myTextActor->SetVisibility(false); + break; + } - vtkCellData* aCellData = aDataSet->GetCellData(); - - vtkIdType aVTKId = myCellPicker->GetCellId(); - if(aVTKId >= 0 && mySelector->IsValid(this,aVTKId,true) && hasIO()){ - vtkIdType anObjId = GetElemObjId(aVTKId); + int anObjId = aMapIndex(1); + vtkCellData* aCellData = aDataSet->GetCellData(); if(vtkCell* aCell = GetElemCell(anObjId)){ vtkPoints* aPts = aCell->GetPoints(); if(int aNbPts = aCell->GetNumberOfPoints()){ @@ -791,6 +794,7 @@ VISU_Actor aCoord[2] += aPntCoord[2]; } + aFlyTo = true; aFlyToCoord[0] = aCoord[0] / aNbPts; aFlyToCoord[1] = aCoord[1] / aNbPts; aFlyToCoord[2] = aCoord[2] / aNbPts; @@ -810,41 +814,32 @@ VISU_Actor vtkCell* aCell = GetElemCell(anObjId); int aVTKID = GetElemVTKID(anObjId); - if (aCell) { - int aNbOfPoints = aCell->GetNumberOfPoints(); - if ( aNbOfPoints > 0 ) { - aStr << getScalar(aCellData, aVTKID); - aStr << getVector(aCellData, aVTKID); + if (aCell) { + int aNbOfPoints = aCell->GetNumberOfPoints(); + if ( aNbOfPoints > 0 ) { + aStr << getScalar(aCellData, aVTKID); + aStr << getVector(aCellData, aVTKID); } } std::string aString = aStr.str(); myTextActor->SetText(aString.c_str()); - - aRet = true; } } - } - break; - } - case NodeSelection:{ - myPointPicker->Pick(theSelectionEvent->myX, - theSelectionEvent->myY, - 0.0, - aRenderer); - - if(myPointPicker->GetActor() != this) - { - aRet = false; break; } + case NodeSelection: + { + if( !aCurrentHasIndex ) + { + myTextActor->SetVisibility(false); + break; + } - vtkPointData* aPntData = aDataSet->GetPointData(); - - vtkIdType aVtkId = myPointPicker->GetPointId(); - if(aVtkId >= 0 && mySelector->IsValid(this,aVtkId,true) && hasIO()){ - vtkIdType anObjId = GetNodeObjId( aVtkId ); + int anObjId = aMapIndex(1); + vtkPointData* aPntData = aDataSet->GetPointData(); if(vtkFloatingPointType* aCoord = GetNodeCoord(anObjId)){ + aFlyTo = true; aFlyToCoord[0] = aCoord[0]; aFlyToCoord[1] = aCoord[1]; aFlyToCoord[2] = aCoord[2]; @@ -889,16 +884,13 @@ VISU_Actor std::string aString = aStr.str(); myTextActor->SetText(aString.c_str()); - - aRet = true; } + break; } - break; - } - case EdgeOfCellSelection: - break; - default: - break; + case EdgeOfCellSelection: + break; + default: + break; } } @@ -913,7 +905,7 @@ VISU_Actor } // FlyTo - if( GetVisibility() && aPickingSettings->GetCameraMovementEnabled() ) + if( GetVisibility() && aPickingSettings->GetCameraMovementEnabled() && aFlyTo ) { vtkRenderWindowInteractor* anInteractor = myInteractor; vtkFloatingPointType aDollyWas = anInteractor->GetDolly(); @@ -927,16 +919,6 @@ VISU_Actor anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas); anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aFlyToCoord); } - - return aRet; -} - -//------------------------------------------------------------------------- -void -VISU_Actor -::Highlight(bool theIsHighlight) -{ - Superclass::Highlight(theIsHighlight); } //------------------------------------------------------------------------- @@ -1005,7 +987,7 @@ VISU_Actor myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition()); myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency()); - highlight(isHighlighted()); + Highlight(isHighlighted()); Update(); } diff --git a/src/OBJECT/VISU_GaussPtsAct.cxx b/src/OBJECT/VISU_GaussPtsAct.cxx index e5eadc85..d8e30ca3 100644 --- a/src/OBJECT/VISU_GaussPtsAct.cxx +++ b/src/OBJECT/VISU_GaussPtsAct.cxx @@ -796,7 +796,6 @@ VISU_GaussPtsAct SVTK_SelectionEvent* theSelectionEvent, bool theIsHighlight) { - //printf( "VISU_GaussPtsAct::Highlight( %d )\n", (int)theIsHighlight ); if ( !GetPickable() ) return false; @@ -940,14 +939,14 @@ VISU_GaussPtsAct anInitialHasIndex, aCurrentHasIndex); - if(!theIsHighlight) - return; - if( aSelectionMode == ActorSelection ) { - Superclass::highlight(theIsHighlight); + Superclass::Highlight(theIsHighlight); return; } + if(!theIsHighlight) + return; + if( aSelectionMode != GaussPointSelection ) return; diff --git a/src/VISUGUI/VISU_msg_en.ts b/src/VISUGUI/VISU_msg_en.ts index 46313199..23684e8d 100644 --- a/src/VISUGUI/VISU_msg_en.ts +++ b/src/VISUGUI/VISU_msg_en.ts @@ -1136,6 +1136,10 @@ Please, refer to the documentation. MEN_SELECTION_INFO Selection Info... + + MEN_SELECTION_PANEL + Selection Panel + MEN_SHADING Shading On @@ -1918,17 +1922,9 @@ Please, provide non-empty resulting presentation. VisuGUI_GaussPointsSelectionPane - - BELOW_POINT - Centered - - - CAMERA_TITLE - Movement of the camera - CURSOR_SIZE - Size of the cursor : + Size of the cursor: CURSOR_TITLE @@ -1938,10 +1934,6 @@ Please, provide non-empty resulting presentation. DISPLAY_PARENT_MESH Display parent mesh element - - INFO_WINDOW_TITLE - Information window - PARENT_MESH_TITLE Parent mesh element @@ -1952,59 +1944,39 @@ Please, provide non-empty resulting presentation. POINT_TOLERANCE - Point tolerance : - - - POSITION - Position : + Point tolerance: PYRAMID_HEIGHT - Height of the pyramids : + Height of the pyramids: SELECTION_COLOR - Selection cursor color : - - - STEP_NUMBER_DSC - Number of steps : - - - STEP_NUMBER_TIP - Number of steps between two positions + Selection cursor color: TOLERANCE_TITLE Tolerance - - TOP_LEFT_CORNER - Top-left corner - - - TRANSPARENCY - Transparency : - - - ZOOM_FACTOR_DSC - Zoom factor : - - - ZOOM_FACTOR_TIP - Zoom at first selected point (ratio) - DATA_POSITION Position PARENT_ELEMENT - Parent mesh element ID: + Parent ID: + + + PARENT_ELEMENT_TIP + Parent mesh element ID LOCAL_POINT - Local Gauss Point ID: + Local ID: + + + LOCAL_POINT_TIP + Local Gauss Point ID @@ -2400,6 +2372,10 @@ Please, provide non-empty resulting presentation. VISU_PICKING_PREF_CAMERA_GROUP_TTL Movement of the camera + + VISU_PICKING_PREF_CAMERA_MOVEMENT + Enable movement of the camera + VISU_PICKING_PREF_CURSOR_GROUP_TTL Cursor @@ -2412,6 +2388,10 @@ Please, provide non-empty resulting presentation. VISU_PICKING_PREF_DISPLAY_PARENT_MESH Display parent mesh element + + VISU_PICKING_PREF_INFO_WINDOW + Enable information window + VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL Information window @@ -3274,11 +3254,11 @@ Please, refer to the documentation. POSITION - Position : + Position: - STEP_NUMBER_DSC - Number of steps : + STEP_NUMBER + Number of steps: STEP_NUMBER_TIP @@ -3290,15 +3270,11 @@ Please, refer to the documentation. TRANSPARENCY - Transparency : + Transparency: - ZOOM_FACTOR_DSC - Zoom factor : - - - ZOOM_FACTOR_TIP - Zoom at first selected point (ratio) + ZOOM_FACTOR + Zoom factor: diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 242de278..f0ab08f5 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -2296,7 +2296,7 @@ VisuGUI createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap), tr("MEN_ERASE_ALL"), "", 0, aParent, false, this, SLOT(OnEraseAll())); - + /* aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION")); createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIcon(aPixmap), tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false, @@ -2306,7 +2306,7 @@ VisuGUI createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIcon(aPixmap), tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false, this); - + */ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL")); createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap), tr("MEN_SELECTION_PANEL"), "", 0, aParent, false, @@ -2400,8 +2400,8 @@ VisuGUI createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe createMenu( VISU_SURFACE, parentId, 10 ); // surface createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all - createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection - createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection + //createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection + //createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection } void @@ -2427,8 +2427,8 @@ VisuGUI createTool( VISU_WIREFRAME, aToolId ); createTool( VISU_SURFACE, aToolId ); createTool( VISU_ERASE_ALL, aToolId ); - createTool( VISU_GLOBAL_SELECTION, aToolId ); - createTool( VISU_PARTIAL_SELECTION, aToolId ); + //createTool( VISU_GLOBAL_SELECTION, aToolId ); + //createTool( VISU_PARTIAL_SELECTION, aToolId ); aToolId = createTool(tr("TOOL_SELECTION")); createTool( VISU_SELECTION_PANEL, aToolId ); @@ -2962,8 +2962,6 @@ VisuGUI setMenuShown( true ); setToolShown( true ); - myInputPanel->show(); - // Reset actions accelerator keys QList shortcuts; shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) ); diff --git a/src/VISUGUI/VisuGUI_GaussPointsSelectionPane.cxx b/src/VISUGUI/VisuGUI_GaussPointsSelectionPane.cxx index 98ed64ed..af0042e6 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsSelectionPane.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsSelectionPane.cxx @@ -330,6 +330,7 @@ VisuGUI_GaussPointsSelectionPane::VisuGUI_GaussPointsSelectionPane( const Salome PositionGroupLayout->setMargin(11); QLabel* ParentElementLabel = new QLabel( tr( "PARENT_ELEMENT" ), PositionGroup ); + ParentElementLabel->setToolTip( tr( "PARENT_ELEMENT_TIP" ) ); myParentElementLineEdit = new VisuGUI_ValidatedLineEdit( PositionGroup ); connect( myParentElementLineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onSelectionValidate() ) ); connect( myParentElementLineEdit, SIGNAL( returnPressed() ), this, SLOT( onSelectionApply() ) ); @@ -339,6 +340,7 @@ VisuGUI_GaussPointsSelectionPane::VisuGUI_GaussPointsSelectionPane( const Salome connect(ParentElementBtn, SIGNAL(clicked()), this, SLOT(onSelectionApply())); QLabel* LocalPointLabel = new QLabel( tr( "LOCAL_POINT" ), PositionGroup ); + LocalPointLabel->setToolTip( tr( "LOCAL_POINT_TIP" ) ); myLocalPointLineEdit = new VisuGUI_ValidatedLineEdit( PositionGroup ); connect( myLocalPointLineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onSelectionValidate() ) ); connect( myLocalPointLineEdit, SIGNAL( returnPressed() ), this, SLOT( onSelectionApply() ) ); diff --git a/src/VISUGUI/VisuGUI_InputPanel.cxx b/src/VISUGUI/VisuGUI_InputPanel.cxx index e634ac8f..ec223e63 100755 --- a/src/VISUGUI/VisuGUI_InputPanel.cxx +++ b/src/VISUGUI/VisuGUI_InputPanel.cxx @@ -64,6 +64,9 @@ void VisuGUI_InputPanel::showPanel( VisuGUI_BasePanel* thePanel ) if ( myCurrentPanel ) myCurrentPanel->hide(); + if( isEmpty() ) + show(); + if ( !myPanels.contains( thePanel ) ) { myPanels.insert( thePanel, true ); @@ -72,9 +75,6 @@ void VisuGUI_InputPanel::showPanel( VisuGUI_BasePanel* thePanel ) connect( thePanel, SIGNAL( bpClose() ), this, SLOT( onClosePanel() ) ); } - if( isEmpty() ) - show(); - thePanel->show(); myCurrentPanel = thePanel; myPanels[ thePanel ] = true; diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index 5a7a269e..13431ff9 100644 --- a/src/VISUGUI/VisuGUI_Module.cxx +++ b/src/VISUGUI/VisuGUI_Module.cxx @@ -768,6 +768,10 @@ createPickingPreferences() int infoWindowGr = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL" ), pickingTab ); setPreferenceProperty( infoWindowGr, "columns", 2 ); + int infoWindowPref = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW" ), infoWindowGr, + LightApp_Preferences::Bool, "VISU", "picking_info_window" ); + setPreferenceProperty( infoWindowPref, "columns", 2 ); + int transparencyPref = addPreference( tr( "VISU_PICKING_PREF_TRANSPARENCY" ), infoWindowGr, LightApp_Preferences::IntSpin, "VISU", "picking_transparency" ); setPreferenceProperty( transparencyPref, "min", 0 ); @@ -789,6 +793,10 @@ createPickingPreferences() int cameraGr = addPreference( tr( "VISU_PICKING_PREF_CAMERA_GROUP_TTL" ), pickingTab ); setPreferenceProperty( cameraGr, "columns", 2 ); + int cameraPref = addPreference( tr( "VISU_PICKING_PREF_CAMERA_MOVEMENT" ), cameraGr, + LightApp_Preferences::Bool, "VISU", "picking_camera_movement" ); + setPreferenceProperty( cameraPref, "columns", 2 ); + int zoomFactorPref = addPreference( tr( "VISU_PICKING_PREF_ZOOM_FACTOR" ), cameraGr, LightApp_Preferences::DblSpin, "VISU", "picking_zoom_factor" ); setPreferenceProperty( zoomFactorPref, "min", 0.1 ); diff --git a/src/VISUGUI/VisuGUI_SelectionPanel.cxx b/src/VISUGUI/VisuGUI_SelectionPanel.cxx index 9a7b6711..4f1a2ce1 100644 --- a/src/VISUGUI/VisuGUI_SelectionPanel.cxx +++ b/src/VISUGUI/VisuGUI_SelectionPanel.cxx @@ -356,12 +356,11 @@ VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModul CameraGroupLayout->setSpacing(6); CameraGroupLayout->setMargin(11); - QLabel* ZoomFactorLabel = new QLabel( tr( "ZOOM_FACTOR_DSC" ), myCameraGroup ); - ZoomFactorLabel->setToolTip( tr( "ZOOM_FACTOR_TIP" ) ); + QLabel* ZoomFactorLabel = new QLabel( tr( "ZOOM_FACTOR" ), myCameraGroup ); myZoomFactorSpinBox = new QtxDoubleSpinBox( 0.1, 10.0, 0.1, myCameraGroup ); myZoomFactorSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - QLabel* StepNumberLabel = new QLabel( tr( "STEP_NUMBER_DSC" ), myCameraGroup ); + QLabel* StepNumberLabel = new QLabel( tr( "STEP_NUMBER" ), myCameraGroup ); StepNumberLabel->setToolTip( tr( "STEP_NUMBER_TIP" ) ); myStepNumberSpinBox = new QtxIntSpinBox( 1, 100, 1, myCameraGroup ); myStepNumberSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); @@ -749,7 +748,7 @@ bool onIdEdit (const QString& theText, SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor(); VISU_Actor* anActor = SVTK::Find(anInteractor->getRenderer()->GetActors(), SVTK::TIsSameIObject( anIO )); - //anActor->Highlight( anIO ); + anActor->Highlight( anIO ); } return true;