-// Copyright (C) 2007-2019 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
TopoDS_Shape SMESH_Gen_i::GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject)
{
TopoDS_Shape S;
- if ( !theGeomObject->_is_nil() && !theGeomObject->_non_existent() ) {
- GEOM_Client* aClient = GetShapeReader();
- GEOM::GEOM_Gen_ptr aGeomEngine = GetGeomEngine();
+ if ( !theGeomObject->_is_nil() && !theGeomObject->_non_existent() )
+ {
+ GEOM_Client* aClient = GetShapeReader();
+ GEOM::GEOM_Gen_var aGeomEngine = GetGeomEngine( theGeomObject );
if ( aClient && !aGeomEngine->_is_nil () )
S = aClient->GetShape( aGeomEngine, theGeomObject );
}
//=======================================================================
//function : publish
-//purpose :
+//purpose :
//=======================================================================
static SALOMEDS::SObject_ptr publish(CORBA::Object_ptr theIOR,
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() );
//=======================================================================
//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())