X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_FieldSelectorWdg.cxx;h=598665a6ea9698f5db91cf089ccdd99835d7de56;hb=1224f8cfd6255dec39cf45bceb42b479e9c47805;hp=3185ea3654b31fe72ba4d3aac378db17aa428db1;hpb=97787812e26d555a6141ece38c9f13167410f425;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_FieldSelectorWdg.cxx b/src/SMESHGUI/SMESHGUI_FieldSelectorWdg.cxx index 3185ea365..598665a6e 100644 --- a/src/SMESHGUI/SMESHGUI_FieldSelectorWdg.cxx +++ b/src/SMESHGUI/SMESHGUI_FieldSelectorWdg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -86,15 +86,11 @@ SMESHGUI_FieldSelectorWdg::SMESHGUI_FieldSelectorWdg( QWidget* p ) * \brief Retrieves all fields defined on geometry of given meshes */ bool SMESHGUI_FieldSelectorWdg:: -GetAllFeilds(const QList< QPair< SMESH::SMESH_IDSource_var, QString > >& meshes, +GetAllFields(const QList< QPair< SMESH::SMESH_IDSource_var, QString > >& meshes, QList< QPair< GEOM::ListOfFields_var, QString > >& fields) { myFields = & fields; myTree->clear(); - - _PTR(Study) study = SMESH::GetActiveStudyDocument(); - GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); - GEOM::GEOM_IFieldOperations_wrap fieldOp = geomGen->GetIFieldOperations( study->StudyId() ); for ( int iM = 0; iM < meshes.count(); ++iM ) { @@ -110,9 +106,25 @@ GetAllFeilds(const QList< QPair< SMESH::SMESH_IDSource_var, QString > >& meshes, QTreeWidgetItem* meshItem = createItem( myTree, meshes[iM].second, iM ); GEOM::GEOM_Object_var shape = mesh->GetShapeToMesh(); + GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( shape ); + GEOM::GEOM_IFieldOperations_wrap fieldOp = geomGen->GetIFieldOperations(); + fields = fieldOp->GetFields( shape ); for ( size_t iF = 0; iF < fields->length(); ++iF ) { + GEOM::field_data_type dataType = fields[ iF ]->GetDataType(); + if ( dataType == GEOM::FDT_String ) + continue; + GEOM::ListOfLong_var stepIDs = fields[ iF ]->GetSteps(); + if ( stepIDs->length() < 1 ) + continue; + GEOM::string_array_var comps = fields[ iF ]->GetComponents(); + if ( comps->length() < 1 ) + continue; + CORBA::Short dim = fields[iF]->GetDimension(); + if ( dim < 0 ) + continue; // "whole shape" field ignored + CORBA::String_var name = fields[iF]->GetName(); createItem( myTree, name.in(), iF, meshItem ); } @@ -153,11 +165,11 @@ GetAllFeilds(const QList< QPair< SMESH::SMESH_IDSource_var, QString > >& meshes, /*! * \brief Filter off not selected fields from myFields */ -bool SMESHGUI_FieldSelectorWdg::GetSelectedFeilds() +bool SMESHGUI_FieldSelectorWdg::GetSelectedFields() { int nbSelected = 0; if ( myTree->isEnabled() ) - for ( size_t i = 0; i < myTree->topLevelItemCount(); ++i ) + for ( int i = 0; i < myTree->topLevelItemCount(); ++i ) { QTreeWidgetItem* meshItem = myTree->topLevelItem( i ); int iM = meshItem->data( 0, Qt::UserRole ).toInt(); @@ -189,7 +201,7 @@ bool SMESHGUI_FieldSelectorWdg::GetSelectedFeilds() } else { - for ( size_t iF = 0; iF < myFields->count(); ++iF ) + for ( int iF = 0; iF < myFields->count(); ++iF ) { GEOM::ListOfFields& fields = (*myFields)[ iF ].first.inout(); fields.length( 0 ); @@ -202,7 +214,7 @@ bool SMESHGUI_FieldSelectorWdg::GetSelectedFeilds() /*! * \brief SLOT called when a tree item is checked */ -void SMESHGUI_FieldSelectorWdg::onItemCheck(QTreeWidgetItem * item, int column) +void SMESHGUI_FieldSelectorWdg::onItemCheck(QTreeWidgetItem * item, int /*column*/) { myTree->blockSignals( true ); if ( !item->parent() ) // mesh item