#include <qlayout.h>
#include <qhbuttongroup.h>
#include <qradiobutton.h>
-#include <qpushbutton.h>
#include <vtkDataSet.h>
#include <vtkCell.h>
mySelection = SALOME_Selection::Selection(visuGUI->GetActiveStudy()->getSelection());
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionEvent()));
-
+
+ myFl = false;
onSelectionChange(0);
}
typedef vtkIdType (vtkDataSet::* TDataSetMethod)();
-void onIdEdit(const QString& theText,
+bool onIdEdit(const QString& theText,
TDataSetMethod theMethod,
bool theIsCell,
SALOME_Selection* theSelection,
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();
}