#include "VisuGUI_FindPane.h"
#include "VISU_Event.h"
+#include "VISU_ConvertorUtils.hxx"
#include "VISU_Actor.h"
#include "VISU_PrsObject_i.hh"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SVTK_ViewWindow.h"
-//#include "SVTK_MainWindow.h"
#include "SVTK_Selector.h"
#include "SVTK_RenderWindowInteractor.h"
#include <QHeaderView>
#include <QTabWidget>
#include <QScrollArea>
+#include <QStackedWidget>
// VTK Includes
#include <vtkDataSetMapper.h>
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" );
- aLabels.append( "J" );
- aLabels.append( "K" );
- aLabels.append( tr("DATA_SCALAR_HDR") );
- aLabels.append( tr("DATA_VECTOR_HDR") );
+ QTableWidget* aTable;
+
+ // Fill column data
+ myColumnData.insert( CellStdCell, QList<int>() << Cell << Scalar << Vector );
+ myColumnData.insert( CellStdPoint, QList<int>() << Point << X << Y << Z << I << J << K << Scalar << Vector );
+ myColumnData.insert( PointStd, QList<int>() << Point << X << Y << Z << I << J << K << Scalar << Vector );
+ myColumnData.insert( CellElno, QList<int>() << Cell << Point << X << Y << Z << I << J << K << Scalar << Vector );
+ myColumnData.insert( PointElno, QList<int>() << Point << X << Y << Z << I << J << K << Cell << Scalar << Vector );
+
+ QMap<int, QString> aColumnHeaders;
+ aColumnHeaders.insert( Cell, tr( "CELL_ID_HDR" ) );
+ aColumnHeaders.insert( Point, tr( "POINT_ID_HDR" ) );
+ aColumnHeaders.insert( X, "X" );
+ aColumnHeaders.insert( Y, "Y" );
+ aColumnHeaders.insert( Z, "Z" );
+ aColumnHeaders.insert( I, "I" );
+ aColumnHeaders.insert( J, "J" );
+ aColumnHeaders.insert( K, "K" );
+ aColumnHeaders.insert( Scalar, tr( "DATA_SCALAR_HDR" ) );
+ aColumnHeaders.insert( Vector, tr( "DATA_VECTOR_HDR" ) );
// Create Points pane
myPointsPane = new QWidget (mainFrame());
QGroupBox* aDataGrp = new QGroupBox ( tr("POINT_DATA_TITLE"), myPointsPane);
QGridLayout* aGridLay = new QGridLayout (aDataGrp);
- aGridLay->addWidget( new QLabel (tr("DATA_ID_LBL"), aDataGrp) , 0, 0 );
+ aGridLay->addWidget( new QLabel (tr("DATA_ID_LBL"), aDataGrp), 0, 0 );
myIDValLbl = new QLineEdit ("", aDataGrp);
aGridLay->addWidget( myIDValLbl, 0, 1 );
aVBoxLayout->addWidget( aDataGrp );
- myListPoints = new QTableWidget (myPointsPane);
- 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);
- myListPoints->setColumnWidth(5, 40);
- myListPoints->setColumnWidth(6, 40);
- myListPoints->setSelectionMode(QAbstractItemView::NoSelection);
- myListPoints->setHorizontalHeaderLabels( aLabels );
-
- aVBoxLayout->addWidget(myListPoints, 1, 0);
+ myPointStackedWg = new QStackedWidget( myPointsPane );
+
+ aTable = new QTableWidget( myPointStackedWg );
+ myPointStackedWg->insertWidget( StdMesh, aTable );
+ myTables.insert( PointStd, aTable );
+
+ aTable = new QTableWidget( myPointStackedWg );
+ myPointStackedWg->insertWidget( ElnoMesh, aTable );
+ myTables.insert( PointElno, aTable );
+
+ aVBoxLayout->addWidget(myPointStackedWg, 1, 0);
// Create Cells pane
myCellsPane = new QWidget (mainFrame());
aGridLay->addWidget( aCellIDBtn, 0, 2 );
connect(aCellIDBtn, SIGNAL(clicked()), this, SLOT(onCellIdEdit()));
- aGridLay->addWidget( new QLabel (tr("DATA_SCALAR_LBL"), aCellGrp), 1, 0);
- myCellScalarValLbl = new QLabel ("", aCellGrp);
- aGridLay->addWidget( myCellScalarValLbl, 1, 1, 1, 2);
- aGridLay->addWidget( new QLabel (tr("DATA_VECTOR_LBL"), aCellGrp), 2, 0);
- myCellVectorValLbl = new QLabel ("", aCellGrp);
- aGridLay->addWidget(myCellVectorValLbl , 2, 1, 1, 2);
-
aCellLayout->addWidget(aCellGrp, 0, 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);
- myCellListPoints->setColumnWidth(5, 40);
- myCellListPoints->setColumnWidth(6, 40);
- myCellListPoints->setSelectionMode(QAbstractItemView::NoSelection);
- myCellListPoints->setHorizontalHeaderLabels( aLabels );
-
- aCellLayout->addWidget(myCellListPoints, 1, 0);
+ myCellStackedWg = new QStackedWidget( myCellsPane );
+
+ QTabWidget* aStdTabWidget = new QTabWidget( myCellStackedWg );
+ myCellStackedWg->insertWidget( StdMesh, aStdTabWidget );
+
+ aTable = new QTableWidget( aStdTabWidget );
+ aStdTabWidget->addTab( aTable, tr("CELL_INFO") );
+ myTables.insert( CellStdCell, aTable );
+
+ aTable = new QTableWidget( aStdTabWidget );
+ aStdTabWidget->addTab( aTable, tr("POINT_INFO") );
+ myTables.insert( CellStdPoint, aTable );
+
+ aTable = new QTableWidget( myCellStackedWg );
+ myCellStackedWg->insertWidget( ElnoMesh, aTable );
+ myTables.insert( CellElno, aTable );
+
+ aCellLayout->addWidget(myCellStackedWg, 1, 0);
+
+ // Common operations for all tables
+ QMap<int, QTableWidget*>::iterator it = myTables.begin(), itEnd = myTables.end();
+ for( ; it != itEnd; ++it )
+ {
+ aTable = it.value();
+ if( !aTable )
+ continue;
+
+ int aTableId = it.key();
+ if( !myColumnData.contains( aTableId ) )
+ continue;
+
+ QStringList aHorizontalHeaderLabels;
+ QList<int> aColumns = myColumnData[ aTableId ];
+ QListIterator<int> aColumnIter( aColumns );
+ while( aColumnIter.hasNext() )
+ {
+ int aColumnId = aColumnIter.next();
+ if( aColumnId >= 0 && aColumnId < aColumnHeaders.size() )
+ aHorizontalHeaderLabels << aColumnHeaders[ aColumnId ];
+ }
+ aTable->setColumnCount( aHorizontalHeaderLabels.size() );
+ aTable->setHorizontalHeaderLabels( aHorizontalHeaderLabels );
+
+ aTable->setEditTriggers( QAbstractItemView::NoEditTriggers );
+ aTable->setSelectionMode( QAbstractItemView::SingleSelection );
+ aTable->resizeColumnsToContents();
+
+ connect( aTable, SIGNAL( doubleClicked( const QModelIndex& ) ),
+ this, SLOT( onDoubleClicked( const QModelIndex& ) ) );
+ }
// Actor Pane
myActorsPane = new QWidget (mainFrame());
}
}
+int VisuGUI_SelectionPanel::column( int theTableId, int theColumnId )
+{
+ if( !myColumnData.contains( theTableId ) )
+ return -1;
+
+ const QList<int>& aColumnList = myColumnData[ theTableId ];
+ return aColumnList.indexOf( theColumnId );
+}
+
+QVariant VisuGUI_SelectionPanel::data( int theTableId, int theRow, int theColumnId )
+{
+ if( !myTables.contains( theTableId ) )
+ return QVariant();
+
+ if( QTableWidget* aTable = myTables[ theTableId ] )
+ if( QAbstractItemModel* aModel = aTable->model() )
+ return aModel->data( aModel->index( theRow, column( theTableId, theColumnId ) ) );
+
+ return QVariant();
+}
+
+void VisuGUI_SelectionPanel::setData( int theTableId, int theRow, int theColumnId, const QVariant& theValue )
+{
+ if( !myTables.contains( theTableId ) )
+ return;
+
+ if( QTableWidget* aTable = myTables[ theTableId ] )
+ if( QAbstractItemModel* aModel = aTable->model() )
+ aModel->setData( aModel->index( theRow, column( theTableId, theColumnId ) ), theValue );
+}
+
+void VisuGUI_SelectionPanel::setRowSpan( int theTableId, int theRow, int theColumnId, int theRowSpan )
+{
+ if( !myTables.contains( theTableId ) )
+ return;
+
+ if( QTableWidget* aTable = myTables[ theTableId ] )
+ aTable->setSpan( theRow, column( theTableId, theColumnId ), theRowSpan, 1 );
+}
+
VisuGUI_SelectionPrefDlg* VisuGUI_SelectionPanel::preferencesDlg()
{
if( !myPreferencesDlg )
void VisuGUI_SelectionPanel::setSelectionMode( int theId )
{
- //printf( "VisuGUI_SelectionPanel::setSelectionMode( %d )\n", theId );
myTabWidget->setCurrentIndex( theId );
}
void VisuGUI_SelectionPanel::onSelectionModeChanged( int theId )
{
- //printf( "VisuGUI_SelectionPanel::onSelectionModeChanged( %d )\n", theId );
SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule);
if (!aViewWindow) return;
VisuGUI_Panel::closeEvent(theEvent);
}
-template<class TData> QString getValue(TData* theData, int theId){
+template<class TData> QString getScalar(TData* theData, int theId){
if (vtkDataArray *aScalar = theData->GetScalars()){
vtkFloatingPointType aVal = aScalar->GetTuple1(theId);
return QString::number(aVal);
}
}
+template<class TData> TValueData getValueData( TPointID thePointVTKID, VISU_Actor* theActor, TData* theData )
+{
+ TValueData aValueData;
+
+ aValueData.Scalar = getScalar( theData, thePointVTKID );
+ aValueData.Vector = getVector( theData, thePointVTKID );
+
+ return aValueData;
+}
+
+TPointData getPointData( TPointID thePointVTKID, VISU_Actor* theActor, const VISU::PIDMapper& theMapper,
+ bool theIsValueData )
+{
+ TPointData aPointData;
+
+ vtkDataSet* aDataSet = theActor->GetMapper()->GetInput();
+
+ vtkFloatingPointType* aCoord = aDataSet->GetPoint( thePointVTKID );
+ aPointData.X = aCoord[0];
+ aPointData.Y = aCoord[1];
+ aPointData.Z = aCoord[2];
+
+ TPointID aPointObjID = theActor->GetNodeObjId( thePointVTKID );
+ VISU::TStructuredId aVec = theMapper->GetIndexesOfNode( aPointObjID );
+ aPointData.I = aVec[0];
+ aPointData.J = aVec[1];
+ aPointData.K = aVec[2];
+
+ if( theIsValueData )
+ aPointData.ValueData = getValueData( thePointVTKID, theActor, aDataSet->GetPointData() );
+
+ return aPointData;
+}
+
void VisuGUI_SelectionPanel::onSelectionEvent() {
SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule);
if (!aViewWindow)
int aType = myTabWidget->currentIndex();
- //if(SVTK_MainWindow* aMainWindow = aViewWindow->getMainWindow())
- //{
- SVTK_RenderWindowInteractor* anInteractor = aViewWindow->GetInteractor();
- myGaussPointsPane->setInteractor(anInteractor);
- //}
+ SVTK_RenderWindowInteractor* anInteractor = aViewWindow->GetInteractor();
+ myGaussPointsPane->setInteractor(anInteractor);
SVTK_Selector* aSelector = aViewWindow->GetSelector();
myDZLbl->setText(QString::number( fabs(aCoord[5]-aCoord[4]) ));
TColStd_IndexedMapOfInteger aMapIndex;
- typedef std::vector<vtkFloatingPointType> TCoordArray;
- typedef map<int, TCoordArray> TPointCoordsMap;
- TPointCoordsMap aPointCoordsMap;
-
aSelector->GetIndex(anIO, aMapIndex);
+ bool aSingleSelection = aMapIndex.Extent() == 1;
vtkDataSet* aDataSet = anVISUActor->GetMapper()->GetInput();
- vtkPointData* aPntData = aDataSet->GetPointData();
-
- QTableWidget* aTable = 0;
- if( aType == 1 )
- aTable = myCellListPoints;
- else if( aType == 2 )
- aTable = myListPoints;
+ bool isElno = VISU::IsElnoData( aDataSet );
- if( !aTable )
- {
- myFl = false;
- return;
- }
+ const VISU::PIDMapper& aMapper = aPrs3d->GetPipeLine()->GetIDMapper();
+ bool isStructured = aMapper->IsStructured();
- bool aSingleSelection = aMapIndex.Extent() == 1;
+ TCellToPointDataMap aCellToPointDataMap;
+ TPointToCellDataMap aPointToCellDataMap;
+ TPointDataMap aGlobalPointDataMap;
for (int ind = 1; ind <= aMapIndex.Extent(); ind++) {
int anID = aMapIndex(ind);
- switch (aType) {
- case 2:
- {
- int aVTKID = anVISUActor->GetNodeVTKID(anID);
- if(aVTKID >= 0){
- vtkFloatingPointType* aCoord = anVISUActor->GetNodeCoord(anID);
-
- if( aSingleSelection )
- myIDValLbl->setText( QString::number(anID) );
-
- vtkIdType aNodeObjId = anVISUActor->GetNodeObjId(aVTKID);
- TCoordArray aCoordArray(aCoord, aCoord + 3);
- aPointCoordsMap[aNodeObjId] = aCoordArray;
+ switch( aType )
+ {
+ case 1:
+ {
+ if( aSingleSelection )
+ myCellIDValLbl->setText( QString::number( anID ) );
+
+ vtkCell* aCell = anVISUActor->GetElemCell( anID );
+ int aCellVTKID = anVISUActor->GetElemVTKID( anID );
+ if( !aCell || aCellVTKID < 0 )
+ break;
+
+ int aNbOfPoints = aCell->GetNumberOfPoints();
+ if( aNbOfPoints < 1 )
+ break;
+
+ TPointDataMap aPointDataMap;
+
+ vtkIdList* aPointList = aCell->GetPointIds();
+ for( int i = 0; i < aNbOfPoints; i++ )
+ {
+ int aPointVTKID = aPointList->GetId(i);
+
+ TPointID aPointID = anVISUActor->GetNodeObjId( aPointVTKID );
+ TPointData aPointData = getPointData( aPointVTKID, anVISUActor, aMapper, true );
+ aPointDataMap[ aPointID ] = aPointData;
+ aGlobalPointDataMap[ aPointID ] = aPointData;
}
+
+ TCellToPointData aCellToPointData;
+ aCellToPointData.CellData = getValueData( aCellVTKID, anVISUActor, aDataSet->GetCellData() );
+ aCellToPointData.PointDataMap = aPointDataMap;
+ aCellToPointDataMap[ anID ] = aCellToPointData;
+ break;
}
- break;
- case 1:
+ case 2:
{
- vtkCellData* aCellData = aDataSet->GetCellData();
- vtkCell* aCell = anVISUActor->GetElemCell(anID);
- int aVTKID = anVISUActor->GetElemVTKID(anID);
- if (aCell != NULL) {
- int aNbOfPoints = aCell->GetNumberOfPoints();
- if ( aNbOfPoints > 0 ) {
- if( aSingleSelection )
- {
- myCellIDValLbl->setText( QString::number(anID) );
- myCellScalarValLbl->setText(getValue(aCellData, aVTKID));
- myCellVectorValLbl->setText(getVector(aCellData, aVTKID));
- }
+ if( aSingleSelection )
+ myIDValLbl->setText( QString::number( anID ) );
+
+ int aPointVTKID = anVISUActor->GetNodeVTKID( anID );
+ if( aPointVTKID < 0 )
+ break;
+
+ TCellDataMap aCellDataMap;
+
+ VISU::TElnoPoints anElnoPoints = VISU::GetElnoPoints( aDataSet, anID );
+ VISU::TElnoPoints::iterator anElnoIter = anElnoPoints.begin();
+ for( ; anElnoIter != anElnoPoints.end(); anElnoIter++ )
+ {
+ VISU::TElnoPointID anElnoPointID = *anElnoIter;
+ VISU::TVTKPointID aVTKPointID = anElnoPointID.first;
+ VISU::TVTKCellID aVTKCellID = anElnoPointID.second;
+
+ TCellID aCellID = anVISUActor->GetElemObjId( aVTKCellID );
+ TValueData aValueData = getValueData( aVTKPointID, anVISUActor, aDataSet->GetPointData() );
+ aCellDataMap[ aCellID ] = aValueData;
+ }
- vtkIdList *aPointList = aCell->GetPointIds();
- for (int i = 0; i < aNbOfPoints; i++) {
- int aNodeVTKId = aPointList->GetId(i);
- vtkFloatingPointType* aCoord = aDataSet->GetPoint(aNodeVTKId);
- vtkIdType aNodeObjId = anVISUActor->GetNodeObjId(aNodeVTKId);
- TCoordArray aCoordArray(aCoord, aCoord + 3);
- aPointCoordsMap[aNodeObjId] = aCoordArray;
- }
- }
- }
+ TPointToCellData aPointToCellData;
+ aPointToCellData.PointData = getPointData( aPointVTKID, anVISUActor, aMapper, !isElno );
+ aPointToCellData.CellDataMap = aCellDataMap;
+ aPointToCellDataMap[ anID ] = aPointToCellData;
+ break;
}
- break;
}
}
- aTable->setRowCount(aPointCoordsMap.size());
- TPointCoordsMap::const_iterator anIter = aPointCoordsMap.begin();
+ // Fill tables
+ QList<int> aTableIds;
+ switch( aType )
+ {
+ case 1:
+ if( isElno )
+ aTableIds.append( CellElno );
+ else
+ {
+ aTableIds.append( CellStdCell );
+ aTableIds.append( CellStdPoint );
+ }
+ break;
+ case 2:
+ aTableIds.append( isElno ? PointElno : PointStd );
+ break;
+ }
- const VISU::PIDMapper& aMapper = aPrs3d->GetPipeLine()->GetIDMapper();
- 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;
-
- //VISU::TIdTypeVector aVec = aMapper->GetIndexesOfNode(aNodeObjId);
- VISU::TStructuredId aVec = aMapper->GetIndexesOfNode(aNodeObjId);
- QString aI,aJ,aK;
- aI = "-";
- aJ = "-";
- aK = "-";
- //switch(aVec.size()){
- //case 3:
- if (aVec[2] != -1)
- aK = QString::number(aVec[2]);
- //case 2:
- if (aVec[1] != -1)
- aJ = QString::number(aVec[1]);
- //case 1:
- if (aVec[0] != -1)
- aI = QString::number(aVec[0]);
- //break;
- //}
-
- 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 );
- aModel->setData( aModel->index(i,2), QVariant(QString::number( aCoordArray[1] )), Qt::DisplayRole );
- aModel->setData( aModel->index(i,3), QVariant(QString::number( aCoordArray[2] )), Qt::DisplayRole );
- aModel->setData( aModel->index(i,4), QVariant( aI ), Qt::DisplayRole );
- aModel->setData( aModel->index(i,5), QVariant( aJ ), Qt::DisplayRole );
- aModel->setData( aModel->index(i,6), QVariant( aK ), Qt::DisplayRole );
-
- vtkIdType aNodeVTKId = anVISUActor->GetNodeVTKID(aNodeObjId);
- aModel->setData( aModel->index(i,7), QVariant(getValue(aPntData, aNodeVTKId)), Qt::DisplayRole );
- aModel->setData( aModel->index(i,8), QVariant(getVector(aPntData, aNodeVTKId)), Qt::DisplayRole );
+ QListIterator<int> aTableIter( aTableIds );
+ while( aTableIter.hasNext() )
+ {
+ int aTableId = aTableIter.next();
+ if( !myTables.contains( aTableId ) )
+ continue;
+
+ QTableWidget* aTable = myTables[ aTableId ];
+ if( !aTable )
+ continue;
+
+ int aRow = -1;
+ switch( aTableId )
+ {
+ case CellStdPoint:
+ {
+ int aRowCount = aGlobalPointDataMap.size();
+ aTable->setRowCount( aRowCount );
+
+ TPointDataMap::const_iterator aPointIter = aGlobalPointDataMap.begin();
+ for( ; aPointIter != aGlobalPointDataMap.end(); aPointIter++ )
+ {
+ aRow++;
+ TPointID aPointID = aPointIter.key();
+ const TPointData& aPointData = aPointIter.value();
+ const TValueData& aValueData = aPointData.ValueData;
+
+ setData( aTableId, aRow, Point, aPointID );
+ setData( aTableId, aRow, X, aPointData.X );
+ setData( aTableId, aRow, Y, aPointData.Y );
+ setData( aTableId, aRow, Z, aPointData.Z );
+ setData( aTableId, aRow, I, aPointData.I );
+ setData( aTableId, aRow, J, aPointData.J );
+ setData( aTableId, aRow, K, aPointData.K );
+ setData( aTableId, aRow, Scalar, aValueData.Scalar );
+ setData( aTableId, aRow, Vector, aValueData.Vector );
+ }
+ break;
+ }
+ case CellStdCell:
+ case CellElno:
+ {
+ int aRowCount = 0;
+ TCellToPointDataMap::const_iterator aCellToPointIter = aCellToPointDataMap.begin();
+ for( ; aCellToPointIter != aCellToPointDataMap.end(); aCellToPointIter++ )
+ {
+ if( aTableId == CellStdCell )
+ aRowCount++;
+ else if( aTableId == CellElno )
+ {
+ const TCellToPointData& aCellToPointData = aCellToPointIter.value();
+ const TPointDataMap& aPointDataMap = aCellToPointData.PointDataMap;
+ int aNbPoints = aPointDataMap.size();
+
+ aRowCount += aNbPoints;
+ }
+ }
+ aTable->setRowCount( aRowCount );
+
+ aCellToPointIter = aCellToPointDataMap.begin();
+ for( ; aCellToPointIter != aCellToPointDataMap.end(); aCellToPointIter++ )
+ {
+ aRow++;
+
+ TCellID aCellID = aCellToPointIter.key();
+ const TCellToPointData& aCellToPointData = aCellToPointIter.value();
+ const TValueData& aCellData = aCellToPointData.CellData;
+
+ setData( aTableId, aRow, Cell, aCellID );
+ if( aTableId == CellStdCell )
+ {
+ setData( aTableId, aRow, Scalar, aCellData.Scalar );
+ setData( aTableId, aRow, Vector, aCellData.Vector );
+ }
+ else if( aTableId == CellElno )
+ {
+ const TPointDataMap& aPointDataMap = aCellToPointData.PointDataMap;
+ int aNbPoints = aPointDataMap.size();
+ if( aNbPoints > 1 )
+ setRowSpan( aTableId, aRow, Cell, aNbPoints );
+
+ TPointDataMap::const_iterator aPointIter = aPointDataMap.begin();
+ for( aRow--; aPointIter != aPointDataMap.end(); aPointIter++ )
+ {
+ aRow++;
+ TPointID aPointID = aPointIter.key();
+ const TPointData& aPointData = aPointIter.value();
+ const TValueData& aValueData = aPointData.ValueData;
+
+ setData( aTableId, aRow, Point, aPointID );
+ setData( aTableId, aRow, X, aPointData.X );
+ setData( aTableId, aRow, Y, aPointData.Y );
+ setData( aTableId, aRow, Z, aPointData.Z );
+ setData( aTableId, aRow, I, aPointData.I );
+ setData( aTableId, aRow, J, aPointData.J );
+ setData( aTableId, aRow, K, aPointData.K );
+ setData( aTableId, aRow, Scalar, aValueData.Scalar );
+ setData( aTableId, aRow, Vector, aValueData.Vector );
+ }
+ }
+ }
+ break;
+ }
+ case PointStd:
+ case PointElno:
+ {
+ int aRowCount = 0;
+ TPointToCellDataMap::const_iterator aPointToCellIter = aPointToCellDataMap.begin();
+ for( ; aPointToCellIter != aPointToCellDataMap.end(); aPointToCellIter++ )
+ {
+ const TPointToCellData& aPointToCellData = aPointToCellIter.value();
+ const TCellDataMap& aCellDataMap = aPointToCellData.CellDataMap;
+ int aNbCells = aCellDataMap.size();
+ if( aNbCells > 1 )
+ aRowCount += aNbCells;
+ else
+ aRowCount++;
+ }
+ aTable->setRowCount( aRowCount );
+
+ aPointToCellIter = aPointToCellDataMap.begin();
+ for( ; aPointToCellIter != aPointToCellDataMap.end(); aPointToCellIter++ )
+ {
+ aRow++;
+
+ TPointID aPointID = aPointToCellIter.key();
+ const TPointToCellData& aPointToCellData = aPointToCellIter.value();
+ const TPointData& aPointData = aPointToCellData.PointData;
+
+ setData( aTableId, aRow, Point, aPointID );
+ setData( aTableId, aRow, X, aPointData.X );
+ setData( aTableId, aRow, Y, aPointData.Y );
+ setData( aTableId, aRow, Z, aPointData.Z );
+ setData( aTableId, aRow, I, aPointData.I );
+ setData( aTableId, aRow, J, aPointData.J );
+ setData( aTableId, aRow, K, aPointData.K );
+
+ if( aTableId == PointElno )
+ {
+ const TCellDataMap& aCellDataMap = aPointToCellData.CellDataMap;
+ int aNbCells = aCellDataMap.size();
+ if( aNbCells > 1 )
+ for( int aColumnId = Point; aColumnId <= K; aColumnId++ )
+ setRowSpan( aTableId, aRow, aColumnId, aNbCells );
+
+ TCellDataMap::const_iterator aCellIter = aCellDataMap.begin();
+ for( aRow--; aCellIter != aCellDataMap.end(); aCellIter++ )
+ {
+ aRow++;
+ TCellID aCellID = aCellIter.key();
+ const TValueData& aCellData = aCellIter.value();
+
+ setData( aTableId, aRow, Cell, aCellID );
+ setData( aTableId, aRow, Scalar, aCellData.Scalar );
+ setData( aTableId, aRow, Vector, aCellData.Vector );
+ }
+ }
+ else
+ {
+ const TValueData& aValueData = aPointData.ValueData;
+ setData( aTableId, aRow, Scalar, aValueData.Scalar );
+ setData( aTableId, aRow, Vector, aValueData.Vector );
+ }
+ }
+ break;
+ }
+ }
+
+ for( int aCol = column( aTableId, I ), aLastCol = column( aTableId, K ); aCol <= aLastCol; aCol++ )
+ if( aCol != -1 )
+ aTable->setColumnHidden( aCol, !isStructured );
+ aTable->resizeColumnsToContents();
}
- //for(int aColumnId = 0; aColumnId < 9; aColumnId++)
- aTable->resizeColumnsToContents();
+
+ int stackId = isElno ? ElnoMesh : StdMesh;
+ QStackedWidget* aStackedWg = aType == 1 ? myCellStackedWg : aType == 2 ? myPointStackedWg : 0;
+ if( aStackedWg )
+ aStackedWg->setCurrentIndex( stackId );
}
}
myFl = false;
void VisuGUI_SelectionPanel::clearFields() {
int aType = myTabWidget->currentIndex();
switch (aType) {
- case 2:
- myIDValLbl->setText( "" );
- myListPoints->setRowCount(0);
- break;
- case 1:
- myCellIDValLbl->setText( "" );
- myCellScalarValLbl->setText("");
- myCellVectorValLbl->setText("");
- myCellListPoints->setRowCount(0);
- break;
case 0:
myXPosLbl->setText("");
myYPosLbl->setText("");
myDXLbl->setText("");
myDYLbl->setText("");
myDZLbl->setText("");
+ break;
+ case 1:
+ myCellIDValLbl->setText( "" );
+ break;
+ case 2:
+ myIDValLbl->setText( "" );
+ break;
}
+
+ QMap<int, QTableWidget*>::iterator it = myTables.begin(), itEnd = myTables.end();
+ for( ; it != itEnd; ++it )
+ if( QTableWidget* aTable = *it )
+ {
+ aTable->clearSpans();
+ aTable->setRowCount(0);
+ aTable->resizeColumnsToContents();
+ }
}
typedef vtkIdType (VISU_PipeLine::* TGetVTKIdMethod)(vtkIdType theID);
aViewWindow->highlight(anIO, true, true);
- //if( SVTK_MainWindow* aMainWindow = aViewWindow->getMainWindow() )
- //{
- SVTK_RenderWindowInteractor* anInteractor = aViewWindow->GetInteractor();
- VISU_Actor* anActor = SVTK::Find<VISU_Actor>(anInteractor->getRenderer()->GetActors(),
- SVTK::TIsSameIObject<VISU_Actor>( anIO ));
- anActor->Highlight( anIO );
- //}
+ SVTK_RenderWindowInteractor* anInteractor = aViewWindow->GetInteractor();
+ VISU_Actor* anActor = SVTK::Find<VISU_Actor>(anInteractor->getRenderer()->GetActors(),
+ SVTK::TIsSameIObject<VISU_Actor>( anIO ));
+ anActor->Highlight( anIO );
return true;
clearFields();
}
+void VisuGUI_SelectionPanel::onDoubleClicked( const QModelIndex& theIndex )
+{
+ QTableWidget* aTable = dynamic_cast<QTableWidget*>( sender() );
+ if( !aTable )
+ return;
+
+ int aTableId = myTables.key( aTable, -1 );
+ if( aTableId == -1 )
+ return;
+
+ int aRow = theIndex.row(), aCol = theIndex.column();
+ const QList<int>& aColumnList = myColumnData[ aTableId ];
+
+ if( aCol >= aColumnList.size() )
+ return;
+
+ int aColumnId = aColumnList[ aCol ];
+
+ bool anIsCellSelection = true;
+ switch( aColumnId )
+ {
+ case Cell:
+ anIsCellSelection = true;
+ break;
+ case Point:
+ case X:
+ case Y:
+ case Z:
+ case I:
+ case J:
+ case K:
+ anIsCellSelection = false;
+ break;
+ case Scalar:
+ case Vector:
+ anIsCellSelection = aTableId == CellStdCell || aTableId == PointElno;
+ break;
+ default:
+ return;
+ }
+
+ int anIdColumnId = anIsCellSelection ? Cell : Point;
+ QVariant anId = data( aTableId, aRow, anIdColumnId );
+
+ bool ok = false;
+ anId.toInt( &ok );
+ if( !ok )
+ return;
+
+ if( anIsCellSelection )
+ {
+ setSelectionMode( 1 );
+ myCellIDValLbl->setText( anId.toString() );
+ onCellIdEdit();
+ }
+ else
+ {
+ setSelectionMode( 2 );
+ myIDValLbl->setText( anId.toString() );
+ onPointIdEdit();
+ }
+}
+
void VisuGUI_SelectionPanel::onIdChanged( int theFirstId, int theSecondId )
{
- //printf( "VisuGUI_SelectionPanel::onIdChanged( %d, %d )\n", theFirstId, theSecondId );
int aType = myTabWidget->currentIndex();
if( aType == 1 )
{