]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
VISU 2008 - Evolution of the VISU selection functionality
authorouv <ouv@opencascade.com>
Tue, 1 Jul 2008 14:00:13 +0000 (14:00 +0000)
committerouv <ouv@opencascade.com>
Tue, 1 Jul 2008 14:00:13 +0000 (14:00 +0000)
src/VISUGUI/VISU_msg_en.ts
src/VISUGUI/VisuGUI_SelectionPanel.cxx
src/VISUGUI/VisuGUI_SelectionPanel.h

index 28309a2f5d273d71aa304dce9e4dbfb20d7b6521..56f7bff6df4ad160ab699a95aebfd3f8ac956b0d 100644 (file)
@@ -3224,6 +3224,14 @@ Please, refer to the documentation.</translation>
            <source>DATA_VECTOR_LBL</source>
             <translation>Vector Value:</translation>
         </message>
+       <message>
+           <source>DATA_SCALAR_HDR</source>
+            <translation>Scalar</translation>
+        </message>
+       <message>
+           <source>DATA_VECTOR_HDR</source>
+            <translation>Vector</translation>
+        </message>
         <message>
            <source>POINT_COORD_TITLE</source>
             <translation>Coordinates</translation>
@@ -3236,14 +3244,6 @@ Please, refer to the documentation.</translation>
            <source>CELL_DATA_ID_LBL</source>
             <translation>ID:</translation>
         </message>
-       <message>
-           <source>CELL_DATA_SCALAR_HDR</source>
-            <translation>Scalar</translation>
-        </message>
-       <message>
-           <source>CELL_DATA_VECTOR_HDR</source>
-            <translation>Vector</translation>
-        </message>
        <message>
            <source>ACTOR_DATA_POSITION_TITLE</source>
             <translation>Position</translation>
index dd2d672ea57940d0ed5489fdc4e584534247e800..27f8dd4fa60f164284198df1d5d75388d4acf9db 100644 (file)
@@ -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("");
index 3daa392a53162cbcc3ce398428d2a5d00ad5081c..3923c4fc33d5dd4883ba2dd82e24c2fcea5396e2 100644 (file)
@@ -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;