From ffd29fbc07f3202b10c5eeba03391dbd83dd7013 Mon Sep 17 00:00:00 2001 From: smh Date: Fri, 7 May 2004 08:55:46 +0000 Subject: [PATCH] SMH: Debug of selection in VISU --- src/VISUGUI/VisuGUI_Selection.cxx | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/VISUGUI/VisuGUI_Selection.cxx b/src/VISUGUI/VisuGUI_Selection.cxx index f90df49b..17eb9d22 100644 --- a/src/VISUGUI/VisuGUI_Selection.cxx +++ b/src/VISUGUI/VisuGUI_Selection.cxx @@ -50,7 +50,6 @@ #include #include #include -#include #include #include @@ -220,7 +219,8 @@ VisuGUI_SelectionDlg::VisuGUI_SelectionDlg() mySelection = SALOME_Selection::Selection(visuGUI->GetActiveStudy()->getSelection()); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionEvent())); - + + myFl = false; onSelectionChange(0); } @@ -414,7 +414,7 @@ void VisuGUI_SelectionDlg::clearFields() { typedef vtkIdType (vtkDataSet::* TDataSetMethod)(); -void onIdEdit(const QString& theText, +bool onIdEdit(const QString& theText, TDataSetMethod theMethod, bool theIsCell, SALOME_Selection* theSelection, @@ -429,29 +429,42 @@ void onIdEdit(const QString& theText, int aMaxId = (aDataSet->*theMethod)(); if(anId < 0) anId = 0; if(aMaxId <= anId) anId = aMaxId-1; + theSelection->ClearIObjects(); theSelection->AddIObject(anIO); VISU_Actor* anVISUActor = visuGUI->GetActor(aPrs3d); - if(theIsCell && !anVISUActor->GetVtkId(anId).empty()){ - theSelection->AddOrRemoveIndex( anIO, anVISUActor->GetVtkId(anId), false ); + if(theIsCell){ + VISU_Actor::TVectorId aVec = anVISUActor->GetVtkId(anId); + if(!aVec.empty()){ + theSelection->AddOrRemoveIndex( anIO, aVec, false ); + return true; + } }else{ theSelection->AddOrRemoveIndex(anIO, anId, false); + return true; } }else{ theMeshName->setText(theValue); theFieldName->setText(""); } + return false; } void VisuGUI_SelectionDlg::onPointIdEdit(const QString& theText){ if (myFl) return; TDataSetMethod aMethod = &vtkDataSet::GetNumberOfPoints; - onIdEdit(theText,aMethod,false,mySelection, - myMeshName,tr("WRN_NO_AVAILABLE_DATA"),myFieldName); + bool anIsSelected = onIdEdit(theText,aMethod,false,mySelection, + myMeshName,tr("WRN_NO_AVAILABLE_DATA"), + myFieldName); + if(!anIsSelected) + clearFields(); } void VisuGUI_SelectionDlg::onCellIdEdit(const QString& theText){ if (myFl) return; TDataSetMethod aMethod = &vtkDataSet::GetNumberOfCells; - onIdEdit(theText,aMethod,true,mySelection, - myMeshName,tr("WRN_NO_AVAILABLE_DATA"),myFieldName); + bool anIsSelected = onIdEdit(theText,aMethod,true,mySelection, + myMeshName,tr("WRN_NO_AVAILABLE_DATA"), + myFieldName); + if(!anIsSelected) + clearFields(); } -- 2.39.2