X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_Gen_i_1.cxx;h=580663d464707729b7e045d832c8e7ee0444fd2f;hp=0b258bf08fa08308ff106b98f40d3980a4fe6f83;hb=6472eab132825fec572beda8276947593f85ffa1;hpb=59fe51ff7f83a733aee46ecad7adb391bc4323bf diff --git a/src/SMESH_I/SMESH_Gen_i_1.cxx b/src/SMESH_I/SMESH_Gen_i_1.cxx index 0b258bf08..580663d46 100644 --- a/src/SMESH_I/SMESH_Gen_i_1.cxx +++ b/src/SMESH_I/SMESH_Gen_i_1.cxx @@ -840,21 +840,25 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishGroup (SMESH::SMESH_Mesh_ptr theMesh, SetName( aRootSO, aRootNames[aType] ); // Add new group to corresponding sub-tree - int isEmpty = false; + int isEmpty = ( theMesh->NbNodes() == 0 ); std::string pm[2] = { "ICON_SMESH_TREE_GROUP", "ICON_SMESH_TREE_MESH_WARN" }; - if ( SMESH::DownCast< SMESH_GroupOnFilter_i* > ( theGroup )) - { - pm[0] = "ICON_SMESH_TREE_GROUP_ON_FILTER"; - } - else if ( SMESH::DownCast< SMESH_Group_i* > ( theGroup )) + if ( !isEmpty ) { - if ( theGroup->GetType() == SMESH::NODE ) - isEmpty = ( theMesh->NbNodes() == 0 ); - else + if ( SMESH::DownCast< SMESH_GroupOnFilter_i* > ( theGroup )) // on filter + { + pm[0] = "ICON_SMESH_TREE_GROUP_ON_FILTER"; + + if ( theGroup->GetType() != SMESH::NODE ) + { + isEmpty = true; + SMESH::array_of_ElementType_var allElemTypes = theMesh->GetTypes(); + for ( size_t i =0; i < allElemTypes->length() && isEmpty; ++i ) + isEmpty = ( allElemTypes[i] != theGroup->GetType() ); + } + } + else // standalone or on geometry { - SMESH::array_of_ElementType_var allElemTypes = theMesh->GetTypes(); - for ( size_t i =0; i < allElemTypes->length() && isEmpty; ++i ) - isEmpty = ( allElemTypes[i] != theGroup->GetType() ); + isEmpty = ( theGroup->Size() == 0 ); } } aGroupSO = publish ( theGroup, aRootSO, 0, pm[isEmpty].c_str() ); @@ -874,14 +878,14 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishGroup (SMESH::SMESH_Mesh_ptr theMesh, //======================================================================= //function : PublishHypothesis -//purpose : +//purpose : //======================================================================= SALOMEDS::SObject_ptr - SMESH_Gen_i::PublishHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp, - const char* theName) +SMESH_Gen_i::PublishHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp, + const char* theName) { - if(MYDEBUG) MESSAGE("PublishHypothesis") + if(MYDEBUG) MESSAGE("PublishHypothesis"); if ( !myIsEnablePublish ) return SALOMEDS::SObject::_nil(); if (theHyp->_is_nil()) @@ -1031,6 +1035,28 @@ void SMESH_Gen_i::highLightInvalid( SALOMEDS::SObject_ptr theSObject, bool isInv } } +//======================================================================= +//function : IsInvalid +//purpose : Check object validity == absence of AttributeTextColor=(178,34,34) +//======================================================================= + +bool SMESH_Gen_i::IsInvalid( SALOMEDS::SObject_ptr theSObject ) +{ + bool isValid = true; + if ( !theSObject->_is_nil() ) + { + SALOMEDS::GenericAttribute_wrap attr; + SALOMEDS::StudyBuilder_var studyBuilder = getStudyServant()->NewBuilder(); + if ( studyBuilder->FindAttribute( theSObject, attr.inout(), "AttributeTextColor" )) + { + SALOMEDS::AttributeTextColor_wrap colorAttr = attr; + SALOMEDS::Color color = colorAttr->TextColor(); + isValid = ( color.R != 178 || color.G != 34 || color.B != 34 ); + } + } + return isValid; +} + //======================================================================= //function : GetMeshOrSubmeshByShape //purpose :