From f8b935b828a756d94d63b770880d8a41644de52d Mon Sep 17 00:00:00 2001 From: skl Date: Mon, 22 Mar 2010 13:30:00 +0000 Subject: [PATCH] Changes for 0020664. --- src/VISU_I/VISU_Table_i.cc | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/src/VISU_I/VISU_Table_i.cc b/src/VISU_I/VISU_Table_i.cc index 7b1f7a0e..bad23432 100644 --- a/src/VISU_I/VISU_Table_i.cc +++ b/src/VISU_I/VISU_Table_i.cc @@ -1243,20 +1243,41 @@ VISU::ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy, TTable2D aNewTable2D; aTable2D.getColumns(aNewTable2D); int kEnd = aNewTable2D.myRows[0].myValues.size(); - aTableOfReal->SetNbColumns(kEnd); + // check empty columns + TColStd_MapOfInteger EmptyColumns; for(int j = 0, jEnd = aNewTable2D.myRows.size(); j < jEnd; j++) { + bool hasVal = false; + for(int k = 0; k < kEnd; k++) { + QString aVal = aNewTable2D.myRows[j].myValues[k].c_str(); + bool anIsOk = false; + double aValue = aVal.toDouble(&anIsOk); + if(anIsOk) { + hasVal = true; + break; + } + } + if(!hasVal) { + EmptyColumns.Add(j); + } + } + // create table of real + aTableOfReal->SetNbColumns( kEnd - EmptyColumns.Extent() ); + int currNum = -1; + for(int j = 0, jEnd = aNewTable2D.myRows.size(); j < jEnd; j++) { + if( EmptyColumns.Contains(j) ) continue; + currNum++; if(MYDEBUG) MESSAGE("j = "<PutValue(aValue,j+1,k+1); + if( anIsOk && !aVal.contains("NAN",Qt::CaseInsensitive) && + !aVal.contains("INF",Qt::CaseInsensitive) ) { + aTableOfReal->PutValue(aValue,currNum+1,k+1); + } } - - aTableOfReal->SetRowTitle(j+1,aNewTable2D.myRows[j].myTitle.c_str()); - aTableOfReal->SetRowUnit(j+1,aNewTable2D.myRows[j].myUnit.c_str()); + aTableOfReal->SetRowTitle(currNum+1,aNewTable2D.myRows[j].myTitle.c_str()); + aTableOfReal->SetRowUnit(currNum+1,aNewTable2D.myRows[j].myUnit.c_str()); } for(int k = 0; k < kEnd; k++) aTableOfReal->SetColumnTitle(k+1,aNewTable2D.myColumnTitles[k].c_str()); -- 2.39.2