#include <qlineedit.h>
#include <qvalidator.h>
#include <qtable.h>
+#include <qtabwidget.h>
// VTK Includes
#include <vtkDataSetMapper.h>
using namespace std;
-
-inline
-QString
-GetNumber( const VISU::TStructuredId& theStructuredId,
- size_t theId )
-{
- if ( theStructuredId[theId] < 0 )
- return "-";
-
- return QString::number( theStructuredId[theId] );
-}
-
-
VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (const SalomeApp_Module* theModule):
QDialog(VISU::GetDesktop(theModule),
0,
TopLayout->setRowStretch(2, 1);
TopLayout->setRowStretch(3, 0);
- QHButtonGroup* aTypeBox = new QHButtonGroup ("Selection", this);
+ myTypeBox = new QHButtonGroup ("Selection", this);
QRadioButton* aPointBtn =
- new QRadioButton ("Point", aTypeBox);
- new QRadioButton ("Cell" , aTypeBox);
- new QRadioButton ("Actor", aTypeBox);
+ new QRadioButton ("Point", myTypeBox);
+ new QRadioButton ("Cell" , myTypeBox);
+ new QRadioButton ("Actor", myTypeBox);
aPointBtn->setChecked(true);
- connect(aTypeBox, SIGNAL(clicked(int)), this, SLOT(onSelectionChange(int)));
+ connect(myTypeBox, SIGNAL(clicked(int)), this, SLOT(onSelectionChange(int)));
- TopLayout->addWidget(aTypeBox, 0, 0);
+ TopLayout->addWidget(myTypeBox, 0, 0);
QWidget* aNamePane = new QWidget (this);
QGridLayout* aNameLay = new QGridLayout (aNamePane);
myWidgetStack = new QWidgetStack (this);
+ QTable* aTable;
+
+ // Fill column data
+ myColumnData.insert( CellStdCell, QValueList<int>() << Cell << Scalar << Vector );
+ myColumnData.insert( CellStdPoint, QValueList<int>() << Point << X << Y << Z << I << J << K << Scalar << Vector );
+ myColumnData.insert( PointStd, QValueList<int>() << Point << X << Y << Z << I << J << K << Scalar << Vector );
+ myColumnData.insert( CellElno, QValueList<int>() << Cell << Point << X << Y << Z << I << J << K << Scalar << Vector );
+ myColumnData.insert( PointElno, QValueList<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 QVBox (myWidgetStack);
myPointsPane->layout()->setSpacing(6);
myIDValLbl->setValidator(aIntValidator);
connect(myIDValLbl, SIGNAL(textChanged(const QString&)), this, SLOT(onPointIdEdit(const QString&)));
- new QLabel ("Scalar Value:", aDataGrp);
- myScalarValLbl = new QLabel ("", aDataGrp);
- new QLabel ("Vector Value:", aDataGrp);
- myVectorValLbl = new QLabel ("", aDataGrp);
- myVectorValLbl->setMinimumWidth(150);
-
- QGroupBox* aCoordGrp = new QGroupBox (4, Qt::Horizontal, "Coordinates", myPointsPane);
- aCoordGrp->layout()->setSpacing(6);
- new QLabel ("X:", aCoordGrp);
- myXValLbl = new QLabel ("", aCoordGrp);
- //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
- new QLabel ("I:", aCoordGrp);
- myIValLbl = new QLabel ("-", aCoordGrp);
- //ENK: 23.11.2006
- new QLabel ("Y:", aCoordGrp);
- myYValLbl = new QLabel ("", aCoordGrp);
- //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
- new QLabel ("J:", aCoordGrp);
- myJValLbl = new QLabel ("-", aCoordGrp);
- //ENK: 23.11.2006
- new QLabel ("Z:",aCoordGrp );
- myZValLbl = new QLabel ("", aCoordGrp);
- //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
- new QLabel ("K:", aCoordGrp);
- myKValLbl = new QLabel ("-", aCoordGrp);
- //ENK: 23.11.2006
+ myPointStackedWg = new QWidgetStack( myPointsPane );
+ myPointsPane->setStretchFactor( myPointStackedWg, 1 );
+
+ aTable = new QTable( myPointStackedWg );
+ myPointStackedWg->addWidget( aTable, StdMesh );
+ myTables.insert( PointStd, aTable );
+ aTable = new QTable( myPointStackedWg );
+ myPointStackedWg->addWidget( aTable, ElnoMesh );
+ myTables.insert( PointElno, aTable );
myWidgetStack->addWidget(myPointsPane, 0);
// Create Cells pane
- myCellsPane = new QWidget (myWidgetStack);
- QGridLayout* aCellLayout = new QGridLayout (myCellsPane);
- aCellLayout->setSpacing(6);
- aCellLayout->setRowStretch(0, 0);
- aCellLayout->setRowStretch(1, 1);
+ myCellsPane = new QVBox (myWidgetStack);
+ myCellsPane->layout()->setSpacing(6);
QGroupBox* aCellGrp = new QGroupBox(2, Qt::Horizontal, "Data of Cell", myCellsPane);
+ aCellGrp->layout()->setSpacing(6);
new QLabel ("ID:", aCellGrp);
myCellIDValLbl = new QLineEdit ("", aCellGrp);
myCellIDValLbl->setValidator(aIntValidator);
connect(myCellIDValLbl, SIGNAL(textChanged(const QString&)), this, SLOT(onCellIdEdit(const QString&)));
- new QLabel ("Scalar Value:", aCellGrp);
- myCellScalarValLbl = new QLabel ("", aCellGrp);
- new QLabel ("Vector Value:", aCellGrp);
- myCellVectorValLbl = new QLabel ("", aCellGrp);
-
- aCellLayout->addWidget(aCellGrp, 0, 0);
-
- myListPoints = new QTable (myCellsPane);
- myListPoints->setReadOnly(true);
- myListPoints->setNumCols(9);
- myListPoints->setNumRows(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(QTable::NoSelection);
- QHeader* aHeader = myListPoints->horizontalHeader();
- aHeader->setLabel( 0, "ID" );
- aHeader->setLabel( 1, "X" );
- aHeader->setLabel( 2, "Y" );
- aHeader->setLabel( 3, "Z" );
- aHeader->setLabel( 4, "I" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
- aHeader->setLabel( 5, "J" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
- aHeader->setLabel( 6, "K" );//ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
- aHeader->setLabel( 7, "Scalar" );
- aHeader->setLabel( 8, "Vector" );
-
- aCellLayout->addWidget(myListPoints, 1, 0);
+ myCellStackedWg = new QWidgetStack( myCellsPane );
+ myCellsPane->setStretchFactor( myCellStackedWg, 1 );
+
+ QTabWidget* aStdTabWidget = new QTabWidget( myCellStackedWg );
+ myCellStackedWg->addWidget( aStdTabWidget, StdMesh );
+
+ aTable = new QTable( aStdTabWidget );
+ aStdTabWidget->addTab( aTable, tr("CELL_INFO") );
+ myTables.insert( CellStdCell, aTable );
+
+ aTable = new QTable( aStdTabWidget );
+ aStdTabWidget->addTab( aTable, tr("POINT_INFO") );
+ myTables.insert( CellStdPoint, aTable );
+
+ aTable = new QTable( myCellStackedWg );
+ myCellStackedWg->addWidget( aTable, ElnoMesh );
+ myTables.insert( CellElno, aTable );
myWidgetStack->addWidget(myCellsPane, 1);
+ // Common operations for all tables
+ QMap<int, QTable*>::iterator it = myTables.begin(), itEnd = myTables.end();
+ for( ; it != itEnd; ++it )
+ {
+ aTable = it.data();
+ if( !aTable )
+ continue;
+
+ int aTableId = it.key();
+ if( !myColumnData.contains( aTableId ) )
+ continue;
+
+ QStringList aHorizontalHeaderLabels;
+ QValueList<int> aColumns = myColumnData[ aTableId ];
+ QValueList<int>::iterator aColumnIter = aColumns.begin();
+ for( ; aColumnIter != aColumns.end(); ++aColumnIter )
+ {
+ int aColumnId = *aColumnIter;
+ if( aColumnId >= 0 && aColumnId < aColumnHeaders.size() )
+ aHorizontalHeaderLabels << aColumnHeaders[ aColumnId ];
+ }
+ aTable->setNumCols( aHorizontalHeaderLabels.size() );
+ aTable->setColumnLabels( aHorizontalHeaderLabels );
+
+ aTable->setReadOnly( true );
+ aTable->setSelectionMode( QTable::NoSelection );
+ for( int aCol = 0, aLastCol = aTable->numCols() - 1; aCol <= aLastCol; aCol++ )
+ aTable->adjustColumn( aCol );
+
+ connect( aTable, SIGNAL( doubleClicked( int, int, int, const QPoint& ) ),
+ this, SLOT( onDoubleClicked( int, int, int, const QPoint& ) ) );
+ }
+
// Actor Pane
myActorsPane = new QVBox (myWidgetStack);
myActorsPane->layout()->setSpacing(6);
}
}
+int VisuGUI_SelectionDlg::column( int theTableId, int theColumnId )
+{
+ if( !myColumnData.contains( theTableId ) )
+ return -1;
+
+ const QValueList<int>& aColumnList = myColumnData[ theTableId ];
+ return aColumnList.findIndex( theColumnId );
+}
+
+QString VisuGUI_SelectionDlg::data( int theTableId, int theRow, int theColumnId )
+{
+ if( !myTables.contains( theTableId ) )
+ return QString();
+
+ if( QTable* aTable = myTables[ theTableId ] )
+ return aTable->text( theRow, column( theTableId, theColumnId ) );
+
+ return QString();
+}
+
+void VisuGUI_SelectionDlg::setData( int theTableId, int theRow, int theColumnId, const QString& theValue )
+{
+ if( !myTables.contains( theTableId ) )
+ return;
+
+ if( QTable* aTable = myTables[ theTableId ] )
+ aTable->setText( theRow, column( theTableId, theColumnId ), theValue );
+}
+
+void VisuGUI_SelectionDlg::setRowSpan( int theTableId, int theRow, int theColumnId, int theRowSpan )
+{
+ if( !myTables.contains( theTableId ) )
+ return;
+
+ if( QTable* aTable = myTables[ theTableId ] )
+ if( QTableItem* anItem = aTable->item( theRow, column( theTableId, theColumnId ) ) )
+ anItem->setSpan( theRowSpan, 1 );
+}
+
void VisuGUI_SelectionDlg::onSelectionChange (int theId)
{
SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule);
QDialog::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;
+}
+
#define ABS(a) (a>=0)?a:-a
void VisuGUI_SelectionDlg::onSelectionEvent() {
}
}
+ clearFields();
if (aPrs3d) {
QString aMeshName("NULL"), aFieldName("NULL");
myDZLbl->setText(QString::number( ABS(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();
+ bool isElno = VISU::IsElnoData( aDataSet );
+
+ const VISU::PIDMapper& aMapper = aPrs3d->GetPipeLine()->GetIDMapper();
+ bool isStructured = aMapper->IsStructured();
+
+ TCellToPointDataMap aCellToPointDataMap;
+ TPointToCellDataMap aPointToCellDataMap;
+ TPointDataMap aGlobalPointDataMap;
for (int ind = 1; ind <= aMapIndex.Extent(); ind++) {
int anID = aMapIndex(ind);
- switch (aType) {
- case 0:
+ switch (aType)
+ {
+ case 0:
{
- 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] ) );
+ if( aSingleSelection )
myIDValLbl->setText( QString::number( anID ) );
-
- if ( !VISU::IsElnoData( aDataSet ) ) {
- myScalarValLbl->setText( getValue( aPntData, aVTKID ) );
- myVectorValLbl->setText( getVector( aPntData, aVTKID ) );
- } else {
- myScalarValLbl->setText( "< ELNO data >" );
- myVectorValLbl->setText( "< ELNO data >" );
- }
- const VISU::PIDMapper& aMapper = aPrs3d->GetPipeLine()->GetIDMapper();
- VISU::TStructuredId aStructuredId = aMapper->GetIndexesOfNode( anID );
- myKValLbl->setText( GetNumber( aStructuredId, 2 ) );
- myJValLbl->setText( GetNumber( aStructuredId, 1 ) );
- myIValLbl->setText( GetNumber( aStructuredId, 0 ) );
- }
+ 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;
+ }
+
+ TPointToCellData aPointToCellData;
+ aPointToCellData.PointData = getPointData( aPointVTKID, anVISUActor, aMapper, !isElno );
+ aPointToCellData.CellDataMap = aCellDataMap;
+ aPointToCellDataMap[ anID ] = aPointToCellData;
+ break;
}
- break;
- case 1:
+ case 1:
{
- vtkCellData* aCellData = aDataSet->GetCellData();
- vtkCell* aCell = anVISUActor->GetElemCell(anID);
- int aVTKID = anVISUActor->GetElemVTKID(anID);
- 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));
-
- 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;
- }
- }
- }
+ 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;
}
}
- myListPoints->setNumRows(aPointCoordsMap.size());
- TPointCoordsMap::const_iterator anIter = aPointCoordsMap.begin();
+ // Fill tables
+ QValueList<int> aTableIds;
+ switch( aType )
+ {
+ case 0:
+ aTableIds.append( isElno ? PointElno : PointStd );
+ break;
+ case 1:
+ if( isElno )
+ aTableIds.append( CellElno );
+ else
+ {
+ aTableIds.append( CellStdCell );
+ aTableIds.append( CellStdPoint );
+ }
+ break;
+ }
- const VISU::PIDMapper& aMapper = aPrs3d->GetPipeLine()->GetIDMapper();
- for (int i = 0; anIter != aPointCoordsMap.end() && i < myListPoints->numRows(); anIter++, i++) {
- myListPoints->verticalHeader()->setLabel(i, QString::number( i ));
- vtkIdType aNodeObjId = anIter->first;
- //ENK: 23.11.2006 - PAL13176 - EDF228 VISU : Enhancement of structured datas processing
- VISU::TStructuredId aStructuredId = aMapper->GetIndexesOfNode(aNodeObjId);
- QString aI = GetNumber(aStructuredId, 0);
- QString aJ = GetNumber(aStructuredId, 1);
- QString aK = GetNumber(aStructuredId, 2);
- //ENK: 23.11.2006
-
- myListPoints->setText(i, 0, QString::number( aNodeObjId ));
- const TCoordArray& aCoordArray = anIter->second;
- myListPoints->setText(i, 1, QString::number( aCoordArray[0] ));
- myListPoints->setText(i, 2, QString::number( aCoordArray[1] ));
- myListPoints->setText(i, 3, QString::number( aCoordArray[2] ));
- myListPoints->setText(i, 4, aI);//ENK: 23.11.2006 - PAL13176
- myListPoints->setText(i, 5, aJ);//ENK: 23.11.2006 - PAL13176
- myListPoints->setText(i, 6, aK);//ENK: 23.11.2006 - PAL13176
-
- vtkIdType aNodeVTKId = anVISUActor->GetNodeVTKID(aNodeObjId);
- myListPoints->setText(i, 7, getValue(aPntData, aNodeVTKId));
- myListPoints->setText(i, 8, getVector(aPntData, aNodeVTKId));
+ QValueList<int>::iterator aTableIter = aTableIds.begin();
+ for( ; aTableIter != aTableIds.end(); ++aTableIter )
+ {
+ int aTableId = *aTableIter;
+ if( !myTables.contains( aTableId ) )
+ continue;
+
+ QTable* aTable = myTables[ aTableId ];
+ if( !aTable )
+ continue;
+
+ int aRow = -1;
+ switch( aTableId )
+ {
+ case CellStdPoint:
+ {
+ int aRowCount = aGlobalPointDataMap.size();
+ aTable->setNumRows( aRowCount );
+
+ TPointDataMap::const_iterator aPointIter = aGlobalPointDataMap.begin();
+ for( ; aPointIter != aGlobalPointDataMap.end(); aPointIter++ )
+ {
+ aRow++;
+ TPointID aPointID = aPointIter.key();
+ const TPointData& aPointData = aPointIter.data();
+ const TValueData& aValueData = aPointData.ValueData;
+
+ setData( aTableId, aRow, Point, QString::number( aPointID ) );
+ setData( aTableId, aRow, X, QString::number( aPointData.X ) );
+ setData( aTableId, aRow, Y, QString::number( aPointData.Y ) );
+ setData( aTableId, aRow, Z, QString::number( aPointData.Z ) );
+ setData( aTableId, aRow, I, QString::number( aPointData.I ) );
+ setData( aTableId, aRow, J, QString::number( aPointData.J ) );
+ setData( aTableId, aRow, K, QString::number( 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.data();
+ const TPointDataMap& aPointDataMap = aCellToPointData.PointDataMap;
+ int aNbPoints = aPointDataMap.size();
+
+ aRowCount += aNbPoints;
+ }
+ }
+ aTable->setNumRows( aRowCount );
+
+ aCellToPointIter = aCellToPointDataMap.begin();
+ for( ; aCellToPointIter != aCellToPointDataMap.end(); aCellToPointIter++ )
+ {
+ aRow++;
+
+ TCellID aCellID = aCellToPointIter.key();
+ const TCellToPointData& aCellToPointData = aCellToPointIter.data();
+ const TValueData& aCellData = aCellToPointData.CellData;
+
+ setData( aTableId, aRow, Cell, QString::number( 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.data();
+ const TValueData& aValueData = aPointData.ValueData;
+
+ setData( aTableId, aRow, Point, QString::number( aPointID ) );
+ setData( aTableId, aRow, X, QString::number( aPointData.X ) );
+ setData( aTableId, aRow, Y, QString::number( aPointData.Y ) );
+ setData( aTableId, aRow, Z, QString::number( aPointData.Z ) );
+ setData( aTableId, aRow, I, QString::number( aPointData.I ) );
+ setData( aTableId, aRow, J, QString::number( aPointData.J ) );
+ setData( aTableId, aRow, K, QString::number( 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.data();
+ const TCellDataMap& aCellDataMap = aPointToCellData.CellDataMap;
+ int aNbCells = aCellDataMap.size();
+ if( aNbCells > 1 )
+ aRowCount += aNbCells;
+ else
+ aRowCount++;
+ }
+ aTable->setNumRows( aRowCount );
+
+ aPointToCellIter = aPointToCellDataMap.begin();
+ for( ; aPointToCellIter != aPointToCellDataMap.end(); aPointToCellIter++ )
+ {
+ aRow++;
+
+ TPointID aPointID = aPointToCellIter.key();
+ const TPointToCellData& aPointToCellData = aPointToCellIter.data();
+ const TPointData& aPointData = aPointToCellData.PointData;
+
+ setData( aTableId, aRow, Point, QString::number( aPointID ) );
+ setData( aTableId, aRow, X, QString::number( aPointData.X ) );
+ setData( aTableId, aRow, Y, QString::number( aPointData.Y ) );
+ setData( aTableId, aRow, Z, QString::number( aPointData.Z ) );
+ setData( aTableId, aRow, I, QString::number( aPointData.I ) );
+ setData( aTableId, aRow, J, QString::number( aPointData.J ) );
+ setData( aTableId, aRow, K, QString::number( 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.data();
+
+ setData( aTableId, aRow, Cell, QString::number( 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;
+ }
+ }
+
+ int aCol, aLastCol;
+ for( aCol = column( aTableId, I ), aLastCol = column( aTableId, K ); aCol <= aLastCol; aCol++ )
+ if( aCol != -1 )
+ isStructured ? aTable->showColumn( aCol ) : aTable->hideColumn( aCol );
+ for( aCol = 0, aLastCol = aTable->numCols() - 1; aCol <= aLastCol; aCol++ )
+ aTable->adjustColumn( aCol );
}
- for(int aColumnId = 0; aColumnId < 9; aColumnId++)
- myListPoints->adjustColumn(aColumnId);
+
+ int stackId = isElno ? ElnoMesh : StdMesh;
+ QWidgetStack* aStackedWg = aType == 0 ? myPointStackedWg : aType == 1 ? myCellStackedWg : 0;
+ if( aStackedWg )
+ aStackedWg->raiseWidget( stackId );
}
- } else {
- clearFields();
}
myFl = false;
}
int aType = myWidgetStack->id(myWidgetStack->visibleWidget());
switch (aType) {
case 0:
- 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("");
+ myIDValLbl->setText( "" );
break;
case 1:
- myCellScalarValLbl->setText("");
- myCellVectorValLbl->setText("");
- myListPoints->setNumRows(0);
+ myCellIDValLbl->setText( "" );
break;
case 2:
myXPosLbl->setText("");
myDYLbl->setText("");
myDZLbl->setText("");
}
+
+ QMap<int, QTable*>::iterator it = myTables.begin(), itEnd = myTables.end();
+ for( ; it != itEnd; ++it )
+ if( QTable* aTable = *it )
+ {
+ aTable->setNumRows(0);
+ for( int aCol = 0, aLastCol = aTable->numCols() - 1; aCol <= aLastCol; aCol++ )
+ aTable->adjustColumn( aCol );
+ }
}
typedef vtkIdType (VISU_PipeLine::* TGetVTKIdMethod)(vtkIdType theID);
void VisuGUI_SelectionDlg::onPointIdEdit (const QString& theText)
{
- if (myFl) return;
+ if (myFl || theText.isEmpty()) return;
TGetVTKIdMethod aMethod = &VISU_PipeLine::GetNodeVTKID;
bool anIsSelected = onIdEdit(theText,
aMethod,
void VisuGUI_SelectionDlg::onCellIdEdit (const QString& theText)
{
- if (myFl) return;
+ if (myFl || theText.isEmpty()) return;
TGetVTKIdMethod aMethod = &VISU_PipeLine::GetElemVTKID;
bool anIsSelected = onIdEdit(theText,
aMethod,
clearFields();
}
+void VisuGUI_SelectionDlg::onDoubleClicked( int theRow, int theCol, int, const QPoint& )
+{
+ QTable* aTable = ( QTable* )sender();
+ if( !aTable )
+ return;
+
+ int aTableId = -1;
+ QMap<int, QTable*>::iterator it = myTables.begin(), itEnd = myTables.end();
+ for( ; it != itEnd; ++it )
+ {
+ if( it.data() == aTable )
+ {
+ aTableId = it.key();
+ break;
+ }
+ }
+
+ if( aTableId == -1 )
+ return;
+
+ const QValueList<int>& aColumnList = myColumnData[ aTableId ];
+ if( theCol >= aColumnList.size() )
+ return;
+
+ int aColumnId = aColumnList[ theCol ];
+
+ 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;
+ QString anId = data( aTableId, theRow, anIdColumnId );
+
+ bool ok = false;
+ anId.toInt( &ok );
+ if( !ok )
+ return;
+
+ if( anIsCellSelection )
+ {
+ myTypeBox->setButton( 1 );
+ onSelectionChange( 1 );
+ myCellIDValLbl->setText( anId );
+ }
+ else
+ {
+ myTypeBox->setButton( 0 );
+ onSelectionChange( 0 );
+ myIDValLbl->setText( anId );
+ }
+}
+
void VisuGUI_SelectionDlg::onHelp()
{
QString aHelpFileName = "selection_info_page.html";