From: ouv Date: Tue, 1 Jul 2008 14:00:13 +0000 (+0000) Subject: VISU 2008 - Evolution of the VISU selection functionality X-Git-Tag: TG_VISU2008_14_07_08~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=129079b23c46cebdb8b3f8ade05ba295ce713fe6;p=modules%2Fvisu.git VISU 2008 - Evolution of the VISU selection functionality --- diff --git a/src/VISUGUI/VISU_msg_en.ts b/src/VISUGUI/VISU_msg_en.ts index 28309a2f..56f7bff6 100644 --- a/src/VISUGUI/VISU_msg_en.ts +++ b/src/VISUGUI/VISU_msg_en.ts @@ -3224,6 +3224,14 @@ Please, refer to the documentation. DATA_VECTOR_LBL Vector Value: + + DATA_SCALAR_HDR + Scalar + + + DATA_VECTOR_HDR + Vector + POINT_COORD_TITLE Coordinates @@ -3236,14 +3244,6 @@ Please, refer to the documentation. CELL_DATA_ID_LBL ID: - - CELL_DATA_SCALAR_HDR - Scalar - - - CELL_DATA_VECTOR_HDR - Vector - ACTOR_DATA_POSITION_TITLE Position diff --git a/src/VISUGUI/VisuGUI_SelectionPanel.cxx b/src/VISUGUI/VisuGUI_SelectionPanel.cxx index dd2d672e..27f8dd4f 100644 --- a/src/VISUGUI/VisuGUI_SelectionPanel.cxx +++ b/src/VISUGUI/VisuGUI_SelectionPanel.cxx @@ -150,6 +150,18 @@ VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModul myTabWidget = new QTabWidget( mainFrame() ); + // Labels for header of points' and cells' tables + QStringList aLabels; + aLabels.append( "ID" ); + aLabels.append( "X" ); + aLabels.append( "Y" ); + aLabels.append( "Z" ); + aLabels.append( "I" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + aLabels.append( "J" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + aLabels.append( "K" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + aLabels.append( tr("DATA_SCALAR_HDR") ); + aLabels.append( tr("DATA_VECTOR_HDR") ); + // Create Points pane myPointsPane = new QWidget (mainFrame()); QVBoxLayout* aVBoxLayout = new QVBoxLayout(myPointsPane); @@ -159,8 +171,6 @@ VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModul //aGridLay->setSpacing(6); aGridLay->addWidget( new QLabel (tr("DATA_ID_LBL"), aDataGrp) , 0, 0 ); - aGridLay->addWidget( new QLabel (tr("DATA_SCALAR_LBL"), aDataGrp), 1, 0 ); - aGridLay->addWidget( new QLabel (tr("DATA_VECTOR_LBL"), aDataGrp), 2, 0 ); myIDValLbl = new QLineEdit ("", aDataGrp); aGridLay->addWidget( myIDValLbl, 0, 1 ); @@ -174,46 +184,23 @@ VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModul aGridLay->addWidget( anIDBtn, 0, 2 ); connect(anIDBtn, SIGNAL(clicked()), this, SLOT(onPointIdEdit())); - myScalarValLbl = new QLabel ("", aDataGrp); - aGridLay->addWidget( myScalarValLbl, 1, 1, 1, 2 ); - - myVectorValLbl = new QLabel ("", aDataGrp); - myVectorValLbl->setMinimumWidth(150); - aGridLay->addWidget( myVectorValLbl, 2, 1, 1, 2 ); - aVBoxLayout->addWidget( aDataGrp ); - QGroupBox* aCoordGrp = new QGroupBox ( tr("POINT_COORD_TITLE"), myPointsPane); - aGridLay = new QGridLayout (aCoordGrp); - //aGridLay->setSpacing(6); + myListPoints = new QTableWidget (myCellsPane); + myListPoints->setEditTriggers( QAbstractItemView::NoEditTriggers ); + myListPoints->setColumnCount(9); + myListPoints->setRowCount(0); + myListPoints->setColumnWidth(0, 40); + myListPoints->setColumnWidth(1, 40); + myListPoints->setColumnWidth(2, 40); + myListPoints->setColumnWidth(3, 40); + myListPoints->setColumnWidth(4, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + myListPoints->setColumnWidth(5, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + myListPoints->setColumnWidth(6, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + myListPoints->setSelectionMode(QAbstractItemView::NoSelection); + myListPoints->setHorizontalHeaderLabels( aLabels ); - aGridLay->addWidget( new QLabel ("X:", aCoordGrp), 0, 0 ); - myXValLbl = new QLabel ("", aCoordGrp); - aGridLay->addWidget( myXValLbl, 0, 1 ); - //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aGridLay->addWidget( new QLabel ("I:", aCoordGrp), 0, 2 ); - myIValLbl = new QLabel ("-", aCoordGrp); - aGridLay->addWidget( myIValLbl, 0, 3 ); - //ENK: 23.11.2006 - aGridLay->addWidget( new QLabel ("Y:", aCoordGrp), 1, 0 ); - myYValLbl = new QLabel ("", aCoordGrp); - aGridLay->addWidget( myYValLbl, 1, 1 ); - //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aGridLay->addWidget( new QLabel ("J:", aCoordGrp), 1, 2 ); - myJValLbl = new QLabel ("-", aCoordGrp); - aGridLay->addWidget( myJValLbl, 1, 3 ); - //ENK: 23.11.2006 - aGridLay->addWidget( new QLabel ("Z:",aCoordGrp ), 2, 0 ); - myZValLbl = new QLabel ("", aCoordGrp); - aGridLay->addWidget( myZValLbl, 2, 1 ); - //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aGridLay->addWidget( new QLabel ("K:", aCoordGrp), 2, 2 ); - myKValLbl = new QLabel ("-", aCoordGrp); - aGridLay->addWidget( myKValLbl, 2, 3 ); - //ENK: 23.11.2006 - - aVBoxLayout->addWidget( aCoordGrp ); - aVBoxLayout->addStretch(); + aVBoxLayout->addWidget(myListPoints, 1, 0); // Create Cells pane myCellsPane = new QWidget (mainFrame()); @@ -245,32 +232,21 @@ VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModul aCellLayout->addWidget(aCellGrp, 0, 0); - myListPoints = new QTableWidget (myCellsPane); - myListPoints->setEditTriggers( QAbstractItemView::NoEditTriggers ); - myListPoints->setColumnCount(9); - myListPoints->setRowCount(0); - myListPoints->setColumnWidth(0, 40); - myListPoints->setColumnWidth(1, 40); - myListPoints->setColumnWidth(2, 40); - myListPoints->setColumnWidth(3, 40); - myListPoints->setColumnWidth(4, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - myListPoints->setColumnWidth(5, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - myListPoints->setColumnWidth(6, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - myListPoints->setSelectionMode(QAbstractItemView::NoSelection); - - QStringList aLabels; - aLabels.append( "ID" ); - aLabels.append( "X" ); - aLabels.append( "Y" ); - aLabels.append( "Z" ); - aLabels.append( "I" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aLabels.append( "J" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aLabels.append( "K" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - aLabels.append( tr("CELL_DATA_SCALAR_HDR") ); - aLabels.append( tr("CELL_DATA_VECTOR_HDR") ); - myListPoints->setHorizontalHeaderLabels( aLabels ); - - aCellLayout->addWidget(myListPoints, 1, 0); + myCellListPoints = new QTableWidget (myCellsPane); + myCellListPoints->setEditTriggers( QAbstractItemView::NoEditTriggers ); + myCellListPoints->setColumnCount(9); + myCellListPoints->setRowCount(0); + myCellListPoints->setColumnWidth(0, 40); + myCellListPoints->setColumnWidth(1, 40); + myCellListPoints->setColumnWidth(2, 40); + myCellListPoints->setColumnWidth(3, 40); + myCellListPoints->setColumnWidth(4, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + myCellListPoints->setColumnWidth(5, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + myCellListPoints->setColumnWidth(6, 40);//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing + myCellListPoints->setSelectionMode(QAbstractItemView::NoSelection); + myCellListPoints->setHorizontalHeaderLabels( aLabels ); + + aCellLayout->addWidget(myCellListPoints, 1, 0); // Actor Pane myActorsPane = new QWidget (mainFrame()); @@ -446,7 +422,6 @@ void VisuGUI_SelectionPanel::onSelectionEvent() { break; default: close(); - //delete this; return; } @@ -519,10 +494,22 @@ void VisuGUI_SelectionPanel::onSelectionEvent() { vtkDataSet* aDataSet = anVISUActor->GetMapper()->GetInput(); vtkPointData* aPntData = aDataSet->GetPointData(); - // controls are cleared in case of multi-selection of sub-elements - //for (int ind = 1; ind <= aMapIndex.Extent(); ind++) { - if( aMapIndex.Extent() == 1 ) { - int anID = aMapIndex(1); + QTableWidget* aTable = 0; + if( aType == 1 ) + aTable = myCellListPoints; + else if( aType == 2 ) + aTable = myListPoints; + + if( !aTable ) + { + myFl = false; + return; + } + + bool aSingleSelection = aMapIndex.Extent() == 1; + + for (int ind = 1; ind <= aMapIndex.Extent(); ind++) { + int anID = aMapIndex(ind); switch (aType) { case 2: @@ -530,29 +517,13 @@ void VisuGUI_SelectionPanel::onSelectionEvent() { int aVTKID = anVISUActor->GetNodeVTKID(anID); if(aVTKID >= 0){ vtkFloatingPointType* aCoord = anVISUActor->GetNodeCoord(anID); - myXValLbl->setText( QString::number( aCoord[0] ) ); - myYValLbl->setText( QString::number( aCoord[1] ) ); - myZValLbl->setText( QString::number( aCoord[2] ) ); - myIDValLbl->setText( QString::number(anID) ); - myScalarValLbl->setText(getValue(aPntData, aVTKID)); - myVectorValLbl->setText(getVector(aPntData, aVTKID)); - //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - const VISU::PIDMapper& aMapper = aPrs3d->GetPipeLine()->GetIDMapper(); - VISU::TIdTypeVector aVec = aMapper->GetIndexesOfNode(anID); - switch(aVec.size()){ - case 3: - myKValLbl->setText(QString::number(aVec[2])); - case 2: - myJValLbl->setText(QString::number(aVec[1])); - case 1: - myIValLbl->setText(QString::number(aVec[0])); - break; - default: - myIValLbl->setText("-"); - myJValLbl->setText("-"); - myKValLbl->setText("-"); - } - //ENK: 23.11.2006 + + if( aSingleSelection ) + myIDValLbl->setText( QString::number(anID) ); + + vtkIdType aNodeObjId = anVISUActor->GetNodeObjId(aVTKID); + TCoordArray aCoordArray(aCoord, aCoord + 3); + aPointCoordsMap[aNodeObjId] = aCoordArray; } } break; @@ -564,9 +535,12 @@ void VisuGUI_SelectionPanel::onSelectionEvent() { if (aCell != NULL) { int aNbOfPoints = aCell->GetNumberOfPoints(); if ( aNbOfPoints > 0 ) { - myCellIDValLbl->setText( QString::number(anID) ); - myCellScalarValLbl->setText(getValue(aCellData, aVTKID)); - myCellVectorValLbl->setText(getVector(aCellData, aVTKID)); + if( aSingleSelection ) + { + myCellIDValLbl->setText( QString::number(anID) ); + myCellScalarValLbl->setText(getValue(aCellData, aVTKID)); + myCellVectorValLbl->setText(getVector(aCellData, aVTKID)); + } vtkIdList *aPointList = aCell->GetPointIds(); for (int i = 0; i < aNbOfPoints; i++) { @@ -583,12 +557,12 @@ void VisuGUI_SelectionPanel::onSelectionEvent() { } } - myListPoints->setRowCount(aPointCoordsMap.size()); + aTable->setRowCount(aPointCoordsMap.size()); TPointCoordsMap::const_iterator anIter = aPointCoordsMap.begin(); const VISU::PIDMapper& aMapper = aPrs3d->GetPipeLine()->GetIDMapper(); - for (int i = 0; anIter != aPointCoordsMap.end() && i < myListPoints->rowCount(); anIter++, i++) { - myListPoints->model()->setHeaderData( i, Qt::Vertical, QVariant(QString::number( i )), Qt::DisplayRole ); + for (int i = 0; anIter != aPointCoordsMap.end() && i < aTable->rowCount(); anIter++, i++) { + aTable->model()->setHeaderData( i, Qt::Vertical, QVariant(QString::number( i )), Qt::DisplayRole ); vtkIdType aNodeObjId = anIter->first; //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing VISU::TIdTypeVector aVec = aMapper->GetIndexesOfNode(aNodeObjId); @@ -607,7 +581,7 @@ void VisuGUI_SelectionPanel::onSelectionEvent() { } //ENK: 23.11.2006 - QAbstractItemModel* aModel = myListPoints->model(); + QAbstractItemModel* aModel = aTable->model(); aModel->setData( aModel->index(i,0), QVariant(QString::number( aNodeObjId )), Qt::DisplayRole ); const TCoordArray& aCoordArray = anIter->second; aModel->setData( aModel->index(i,1), QVariant(QString::number( aCoordArray[0] )), Qt::DisplayRole ); @@ -622,7 +596,7 @@ void VisuGUI_SelectionPanel::onSelectionEvent() { aModel->setData( aModel->index(i,8), QVariant(getVector(aPntData, aNodeVTKId)), Qt::DisplayRole ); } //for(int aColumnId = 0; aColumnId < 9; aColumnId++) - myListPoints->resizeColumnsToContents(); + aTable->resizeColumnsToContents(); } } myFl = false; @@ -633,20 +607,13 @@ void VisuGUI_SelectionPanel::clearFields() { switch (aType) { case 2: myIDValLbl->setText( "" ); - myXValLbl->setText( "" ); - myYValLbl->setText( "" ); - myZValLbl->setText( "" ); - myIValLbl->setText( "-" );//ENK: 23.11.2006 - PAL13176 - myJValLbl->setText( "-" );//ENK: 23.11.2006 - PAL13176 - myKValLbl->setText( "-" );//ENK: 23.11.2006 - PAL13176 - myScalarValLbl->setText(""); - myVectorValLbl->setText(""); + myListPoints->setRowCount(0); break; case 1: myCellIDValLbl->setText( "" ); myCellScalarValLbl->setText(""); myCellVectorValLbl->setText(""); - myListPoints->setRowCount(0); + myCellListPoints->setRowCount(0); break; case 0: myXPosLbl->setText(""); diff --git a/src/VISUGUI/VisuGUI_SelectionPanel.h b/src/VISUGUI/VisuGUI_SelectionPanel.h index 3daa392a..3923c4fc 100644 --- a/src/VISUGUI/VisuGUI_SelectionPanel.h +++ b/src/VISUGUI/VisuGUI_SelectionPanel.h @@ -93,23 +93,14 @@ private: QTabWidget* myTabWidget; QWidget* myPointsPane; QWidget* myCellsPane; - QLabel* myXValLbl; - QLabel* myYValLbl; - QLabel* myZValLbl; - //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing - QLabel* myIValLbl; //!< used for structured mesh selection - QLabel* myJValLbl; //!< used for structured mesh selection - QLabel* myKValLbl; //!< used for structured mesh selection - //ENK: 23.11.2006 QLineEdit* myIDValLbl; - QLabel* myScalarValLbl; - QLabel* myVectorValLbl; - QTableWidget* myListPoints; + QLineEdit* myCellIDValLbl; QLabel* myCellScalarValLbl; QLabel* myCellVectorValLbl; + QTableWidget* myCellListPoints; QWidget* myActorsPane; QLabel* myXPosLbl;