static VisuGUI_SelectionDlg* mySelectionDlg = NULL;
-VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (QWidget* parent)
- : QDialog(parent, 0, false, WStyle_Customize | WStyle_NormalBorder |
- WStyle_Title | WStyle_SysMenu | WDestructiveClose),
- mySelectionMgr(NULL)
+VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (const SalomeApp_Module* theModule):
+ QDialog(VISU::GetDesktop(theModule),
+ 0,
+ false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+ mySelectionMgr(NULL),
+ myModule(theModule)
{
if (mySelectionDlg)
mySelectionDlg->close(true);
myFl = false;
// Activate Points pane
- SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
myWidgetStack->raiseWidget(myPointsPane);
- if (aSVTKVW)
- aSVTKVW->SetSelectionMode(NodeSelection);
+ if(SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule))
+ aViewWindow->SetSelectionMode(NodeSelection);
onSelectionEvent();
mySelectionDlg = this;
void VisuGUI_SelectionDlg::onSelectionChange (int theId)
{
- SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
- if (!aSVTKVW) return;
+ SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule);
+ if (!aViewWindow) return;
switch (theId) {
case 0: // Points
myWidgetStack->raiseWidget(myPointsPane);
- aSVTKVW->SetSelectionMode(NodeSelection);
+ aViewWindow->SetSelectionMode(NodeSelection);
onPointIdEdit(myIDValLbl->text());
break;
case 1: // Cells
myWidgetStack->raiseWidget(myCellsPane);
- aSVTKVW->SetSelectionMode(CellSelection);
+ aViewWindow->SetSelectionMode(CellSelection);
onCellIdEdit(myCellIDValLbl->text());
break;
case 2: // Actor
myWidgetStack->raiseWidget(myActorsPane);
- aSVTKVW->SetSelectionMode(ActorSelection);
+ aViewWindow->SetSelectionMode(ActorSelection);
onSelectionEvent();
}
}
void VisuGUI_SelectionDlg::closeEvent (QCloseEvent* theEvent)
{
- SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
-
- mySelectionDlg = NULL;
- if (aSVTKVW)
- aSVTKVW->SetSelectionMode(ActorSelection);
- disconnect(mySelectionMgr,0,0,0);
+ if( mySelectionDlg )
+ {
+ mySelectionDlg = NULL;
+ disconnect(mySelectionMgr,0,0,0);
+ if(SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule)){
+ switch(aViewWindow->SelectionMode()){
+ case NodeSelection:
+ case CellSelection:
+ aViewWindow->SetSelectionMode(ActorSelection);
+ break;
+ }
+ }
+ }
QDialog::closeEvent(theEvent);
}
#define ABS(a) (a>=0)?a:-a
void VisuGUI_SelectionDlg::onSelectionEvent() {
- SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
- if (!aSVTKVW) return;
+ SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule);
+ if (!aViewWindow) return;
+
+ switch(aViewWindow->SelectionMode()){
+ case NodeSelection:
+ case CellSelection:
+ case ActorSelection:
+ break;
+ default:
+ close( TRUE );
+ return;
+ }
if (myFl) return;
myFl = true;
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
(SUIT_Session::session()->activeApplication());
- SVTK_Selector* aSelector = aSVTKVW->GetSelector();
+ SVTK_Selector* aSelector = aViewWindow->GetSelector();
VISU::Prs3d_i* aPrs3d = NULL;
_PTR(SObject) aSObject;
Handle(SALOME_InteractiveObject) anIO;
SALOME_ListIO aListIO;
- mySelectionMgr->selectedObjects(aListIO, SVTK_Viewer::Type());
+ mySelectionMgr->selectedObjects(aListIO);
if (aListIO.Extent() == 1) {
anIO = aListIO.First();
myFieldName->setText((aFieldName == "NULL") ? QString("No name") : aFieldName);
VISU_Actor* anVISUActor =
- VISU::FindActor(aSVTKVW, aSObject->GetID().c_str());
+ VISU::FindActor(aViewWindow, aSObject->GetID().c_str());
if (anVISUActor) {
float aCoord[6];
anVISUActor->GetBounds(aCoord);
vtkPointData* aPntData = aDataSet->GetPointData();
for (int ind = 1; ind <= aMapIndex.Extent(); ind++) {
- int aID = aMapIndex(ind);
+ int anID = aMapIndex(ind);
switch (aType) {
case 0:
{
- float aCoord[3];
- aDataSet->GetPoint(aID, aCoord);
+ float* aCoord = anVISUActor->GetNodeCoord(anID);
+ int aVTKID = anVISUActor->GetNodeVTKID(anID);
myXValLbl->setText( QString::number( aCoord[0] ) );
myYValLbl->setText( QString::number( aCoord[1] ) );
myZValLbl->setText( QString::number( aCoord[2] ) );
- myIDValLbl->setText( QString::number(aID) );
- myScalarValLbl->setText(getValue(aPntData, aID));
- myVectorValLbl->setText(getVector(aPntData, aID));
+ myIDValLbl->setText( QString::number(anID) );
+ myScalarValLbl->setText(getValue(aPntData, aVTKID));
+ myVectorValLbl->setText(getVector(aPntData, aVTKID));
}
break;
case 1:
{
- vtkCellData* aData = aDataSet->GetCellData();
- vtkCell* aCell = aDataSet->GetCell(aID);
+ vtkCellData* aCellData = aDataSet->GetCellData();
+ vtkCell* aCell = anVISUActor->GetElemCell(anID);
+ int aVTKID = anVISUActor->GetElemVTKID(anID);
if (aCell != NULL) {
int aNbOfPoints = aCell->GetNumberOfPoints();
- if (aNbOfPoints <=1 ) { // Cell is point
+ if ( aNbOfPoints <= 1 ) { // Cell is point
clearFields();
} else {
- myCellIDValLbl->setText( QString::number(aID) );
- myCellScalarValLbl->setText(getValue(aData, aID));
- myCellVectorValLbl->setText(getVector(aData, aID));
+ myCellIDValLbl->setText( QString::number(anID) );
+ myCellScalarValLbl->setText(getValue(aCellData, aVTKID));
+ myCellVectorValLbl->setText(getVector(aCellData, aVTKID));
float* aCoord;
vtkIdList *aPointList = aCell->GetPointIds();
bool onIdEdit (const QString& theText,
TDataSetMethod theMethod,
bool theIsCell,
+ const SalomeApp_Module* theModule,
LightApp_SelectionMgr* theSelectionMgr,
QLabel* theMeshName,
QString theValue,
QLabel* theFieldName)
{
- SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
- (SUIT_Session::session()->activeApplication());
- SVTK_ViewWindow* aSVTKVW = VISU::GetViewWindow();
- if (!aSVTKVW) return false;
- SVTK_Selector* aSelector = aSVTKVW->GetSelector();
+ SalomeApp_Application* anApp = theModule->getApp();
+ SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(theModule);
+ if (!aViewWindow) return false;
+ SVTK_Selector* aSelector = aViewWindow->GetSelector();
VISU::Prs3d_i* aPrs3d = NULL;
Handle(SALOME_InteractiveObject) anIO;
TColStd_MapOfInteger newIndices;
newIndices.Add(anId);
aSelector->AddOrRemoveIndex(anIO, newIndices, false);
- aSVTKVW->highlight(anIO, true, true);
+ aViewWindow->highlight(anIO, true, true);
return true;
{
if (myFl) return;
TDataSetMethod aMethod = &vtkDataSet::GetNumberOfPoints;
- bool anIsSelected = onIdEdit(theText,aMethod,false,mySelectionMgr,
+ bool anIsSelected = onIdEdit(theText,aMethod,false,myModule,mySelectionMgr,
myMeshName,tr("WRN_NO_AVAILABLE_DATA"),
myFieldName);
if (anIsSelected)
{
if (myFl) return;
TDataSetMethod aMethod = &vtkDataSet::GetNumberOfCells;
- bool anIsSelected = onIdEdit(theText,aMethod,true,mySelectionMgr,
+ bool anIsSelected = onIdEdit(theText,aMethod,true,myModule,mySelectionMgr,
myMeshName,tr("WRN_NO_AVAILABLE_DATA"),
myFieldName);
if (anIsSelected)