From: admin Date: Wed, 28 May 2008 07:35:23 +0000 (+0000) Subject: This commit was generated by cvs2git to create tag X-Git-Tag: TG_ELNO_visualization_28May2008 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=410f59d05e929adf2753c8741fbd20a32149358f;p=modules%2Fvisu.git This commit was generated by cvs2git to create tag 'TG_ELNO_visualization_28May2008'. Sprout from V4_1_0_maintainance 2008-05-23 07:29:08 UTC apo 'Just code layouting improvement' Cherrypick from V4_1_0_maintainance 2008-05-28 07:35:22 UTC apo 'Fix for Bug IPAL19822': src/CONVERTOR/VISU_ConvertorUtils.cxx src/CONVERTOR/VISU_ConvertorUtils.hxx src/PIPELINE/VISU_ElnoDisassembleFilter.cxx src/VISUGUI/VisuGUI_Selection.cxx --- diff --git a/src/CONVERTOR/VISU_ConvertorUtils.cxx b/src/CONVERTOR/VISU_ConvertorUtils.cxx index a4cee79f..9a2dd969 100644 --- a/src/CONVERTOR/VISU_ConvertorUtils.cxx +++ b/src/CONVERTOR/VISU_ConvertorUtils.cxx @@ -233,6 +233,23 @@ namespace VISU return aDataSetAttributes->GetArray("VISU_FIELD") != NULL; } + //--------------------------------------------------------------- + bool + IsElnoData(vtkDataSet* theDataSet) + { + theDataSet->Update(); + + if ( vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetCellData() ) + if ( aDataSetAttributes->GetArray( "ELNO_FIELD" ) != NULL ) + return true; + + if ( vtkDataSetAttributes *aDataSetAttributes = theDataSet->GetPointData() ) + if ( aDataSetAttributes->GetArray( "ELNO_POINT_COORDS" ) != NULL ) + return true; + + return false; + } + //--------------------------------------------------------------- vtkIdType diff --git a/src/CONVERTOR/VISU_ConvertorUtils.hxx b/src/CONVERTOR/VISU_ConvertorUtils.hxx index 17c12fde..2c1bff92 100644 --- a/src/CONVERTOR/VISU_ConvertorUtils.hxx +++ b/src/CONVERTOR/VISU_ConvertorUtils.hxx @@ -90,6 +90,11 @@ namespace VISU bool IsDataOnCells(vtkDataSet* theDataSet); + //--------------------------------------------------------------- + VISU_CONVERTOR_EXPORT + bool + IsElnoData(vtkDataSet* theDataSet); + //--------------------------------------------------------------- VISU_CONVERTOR_EXPORT diff --git a/src/PIPELINE/VISU_ElnoDisassembleFilter.cxx b/src/PIPELINE/VISU_ElnoDisassembleFilter.cxx index a1d17d6b..eb84ca41 100644 --- a/src/PIPELINE/VISU_ElnoDisassembleFilter.cxx +++ b/src/PIPELINE/VISU_ElnoDisassembleFilter.cxx @@ -102,8 +102,8 @@ namespace vtkPointData *myOutputPointData; TPointsDataArray *myInputPointsArray; TPointsDataArray *myOutputPointsArray; - TElnoDataArray* myElnoPointDataArray; - TElnoDataArray* myElnoPointVectors; + TElnoDataArray* myElnoFullDataArray; + TElnoDataArray* myElnoPartialDataArray; TPointsDataArray *myElnoPointCoords; vtkIntArray* myInputPointsMapper; vtkIntArray* myOutputPointsMapper; @@ -138,17 +138,21 @@ namespace myOutputPointData->Allocate( aNbPoints ); vtkCellData *anInputCellData = theInput->GetCellData(); - vtkDataArray* aVectors = anInputCellData->GetVectors(); - myElnoPointDataArray = TElnoDataArray::New(); - myElnoPointDataArray->SetName( "VISU_FIELD" ); - myElnoPointDataArray->SetNumberOfComponents( myGetElnoNodeData.getNbComp() ); - myElnoPointDataArray->SetNumberOfTuples( aNbPoints ); - - myElnoPointVectors = TElnoDataArray::New(); - myElnoPointVectors->SetName( aVectors->GetName() ); - myElnoPointVectors->SetNumberOfComponents( 3 ); - myElnoPointVectors->SetNumberOfTuples( aNbPoints ); + // To create a new copy of initial data for output + myElnoFullDataArray = TElnoDataArray::New(); + myElnoFullDataArray->SetName( "VISU_FIELD" ); + myElnoFullDataArray->SetNumberOfComponents( myGetElnoNodeData.getNbComp() ); + myElnoFullDataArray->SetNumberOfTuples( aNbPoints ); + + // To create a new copy of partial initial data for output + myElnoPartialDataArray = TElnoDataArray::New(); + // This partial data can be represented as in terms of vectors as scalars + if ( anInputCellData->GetVectors() != NULL ) + myElnoPartialDataArray->SetNumberOfComponents( 3 ); + else + myElnoPartialDataArray->SetNumberOfComponents( 1 ); + myElnoPartialDataArray->SetNumberOfTuples( aNbPoints ); myElnoPointCoords = TPointsDataArray::New(); myElnoPointCoords->SetName( "ELNO_POINT_COORDS" ); @@ -186,11 +190,14 @@ namespace //anOutputPointData->PassData( anInputPointData ); - myOutputPointData->AddArray( myElnoPointDataArray ); - myElnoPointDataArray->Delete(); + myOutputPointData->AddArray( myElnoFullDataArray ); + myElnoFullDataArray->Delete(); - myOutputPointData->SetVectors( myElnoPointVectors ); - myElnoPointVectors->Delete(); + if ( anInputCellData->GetVectors() != NULL ) + myOutputPointData->SetVectors( myElnoPartialDataArray ); + else + myOutputPointData->SetScalars( myElnoPartialDataArray ); + myElnoPartialDataArray->Delete(); myOutputPointData->AddArray( myElnoPointCoords ); myElnoPointCoords->Delete(); @@ -224,10 +231,10 @@ namespace myOutputPointData->CopyData( myInputPointData, aCurrentPntId, aNewPntId ); TElnoDataType* anElnoData = myGetElnoNodeData( aCellId, aPntId ); - myElnoPointDataArray->SetTupleValue( aNewPntId, anElnoData ); + myElnoFullDataArray->SetTupleValue( aNewPntId, anElnoData ); - myElnoPointDataArray->GetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] ); - myElnoPointVectors->SetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] ); + myElnoFullDataArray->GetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] ); + myElnoPartialDataArray->SetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] ); myInputPointsMapper->GetTupleValue( aCurrentPntId, &anPointsMapperValues[ 0 ] ); myOutputPointsMapper->SetTupleValue( aNewPntId, &anPointsMapperValues[ 0 ] ); @@ -285,10 +292,10 @@ namespace myOutputPointData->CopyData( myInputPointData, aCurrentPntId, aNewPntId ); TElnoDataType* anElnoData = myGetElnoNodeData( aCellId, aPntId ); - myElnoPointDataArray->SetTupleValue( aNewPntId, anElnoData ); + myElnoFullDataArray->SetTupleValue( aNewPntId, anElnoData ); - myElnoPointDataArray->GetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] ); - myElnoPointVectors->SetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] ); + myElnoFullDataArray->GetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] ); + myElnoPartialDataArray->SetTupleValue( aNewPntId, &anElnoDataValues[ 0 ] ); myInputPointsMapper->GetTupleValue( aCurrentPntId, &anPointsMapperValues[ 0 ] ); myOutputPointsMapper->SetTupleValue( aNewPntId, &anPointsMapperValues[ 0 ] ); diff --git a/src/VISUGUI/VisuGUI_Selection.cxx b/src/VISUGUI/VisuGUI_Selection.cxx index 4670d7cf..d2e699a8 100644 --- a/src/VISUGUI/VisuGUI_Selection.cxx +++ b/src/VISUGUI/VisuGUI_Selection.cxx @@ -54,6 +54,8 @@ #include "SVTK_ViewWindow.h" #include "SVTK_Selector.h" +#include "VISU_ConvertorUtils.hxx" + #include "utilities.h" // OCCT Includes @@ -445,22 +447,28 @@ void VisuGUI_SelectionDlg::onSelectionEvent() { case 0: { int aVTKID = anVISUActor->GetNodeVTKID(anID); - if(aVTKID >= 0){ + 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)); + 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); + VISU::TStructuredId aStructuredId = aMapper->GetIndexesOfNode( anID ); myKValLbl->setText( GetNumber( aStructuredId, 2 ) ); myJValLbl->setText( GetNumber( aStructuredId, 1 ) ); myIValLbl->setText( GetNumber( aStructuredId, 0 ) ); - } - } + } + } break; case 1: {