void SMESHGUI_BaseComputeOp::onPublishShape()
{
- GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
GEOM::GEOM_Object_var meshShape = myMesh->GetShapeToMesh();
+ GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( meshShape );
QStringList entryList;
QList<int> rows;
{
myFields = & fields;
myTree->clear();
-
- GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
- GEOM::GEOM_IFieldOperations_wrap fieldOp = geomGen->GetIFieldOperations();
for ( int iM = 0; iM < meshes.count(); ++iM )
{
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 )
{
namespace SMESH
{
- GEOM::GEOM_Gen_var GetGEOMGen()
+ GEOM::GEOM_Gen_var GetGEOMGen( GEOM::GEOM_Object_ptr go )
{
- static GEOM::GEOM_Gen_var aGEOMGen;
-
- if(CORBA::is_nil(aGEOMGen)) {
- if ( GeometryGUI::GetGeomGen()->_is_nil() )
- GeometryGUI::InitGeomGen();
- aGEOMGen = GeometryGUI::GetGeomGen();
- }
- return aGEOMGen;
+ GEOM::GEOM_Gen_ptr gen;
+ if ( !CORBA::is_nil( go ))
+ gen = go->GetGen();
+ return gen;
}
GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh(_PTR(SObject) theMeshOrSubmesh,
GEOM::GEOM_Object_ptr GetSubShape (GEOM::GEOM_Object_ptr theMainShape,
long theID)
{
- GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
+ if ( CORBA::is_nil( theMainShape ))
+ return GEOM::GEOM_Object::_nil();
+
+ GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( theMainShape );
if (geomGen->_is_nil())
return GEOM::GEOM_Object::_nil();
- GEOM::GEOM_IShapesOperations_wrap aShapesOp =
- geomGen->GetIShapesOperations();
+
+ GEOM::GEOM_IShapesOperations_wrap aShapesOp = geomGen->GetIShapesOperations();
if (aShapesOp->_is_nil())
return GEOM::GEOM_Object::_nil();
- GEOM::GEOM_Object_wrap subShape = aShapesOp->GetSubShape (theMainShape,theID);
+
+ GEOM::GEOM_Object_wrap subShape = aShapesOp->GetSubShape( theMainShape, theID );
return subShape._retn();
}
namespace SMESH
{
- SMESHGUI_EXPORT GEOM::GEOM_Gen_var GetGEOMGen();
+ SMESHGUI_EXPORT GEOM::GEOM_Gen_var GetGEOMGen( GEOM::GEOM_Object_ptr go );
SMESHGUI_EXPORT GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh( _PTR(SObject), bool* isMesh=0 );
SMESHGUI_EXPORT GEOM::GEOM_Object_var GetGeom( Handle(SALOME_InteractiveObject) io );
- SMESHGUI_EXPORT char* GetGeomName( _PTR(SObject) smeshSO );
+ SMESHGUI_EXPORT char* GetGeomName( _PTR(SObject) smeshSO );
SMESHGUI_EXPORT GEOM::GEOM_Object_ptr GetSubShape( GEOM::GEOM_Object_ptr, long );
}
else {
SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
- if ( aSMESHGen->_is_nil() )
+ if ( aSMESHGen->_is_nil() || myGeomObjects->length() == 0 )
return false;
// create a geometry group
- GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
-
+ GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( myGeomObjects[0] );
if (geomGen->_is_nil())
return false;
// check and add all selected GEOM objects: they must be
// a sub-shapes of the main GEOM and must be of one type
TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
- for ( int i =0; i < (int)myGeomObjects->length(); i++) {
+ for ( CORBA::ULong i =0; i < myGeomObjects->length(); i++)
+ {
TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)myGeomObjects[i]->GetShapeType();
- if (i == 0)
+ if ( i == 0 )
aGroupType = aSubShapeType;
- else if (aSubShapeType != aGroupType) {
+ else if ( aSubShapeType != aGroupType ) {
aGroupType = TopAbs_SHAPE;
break;
}
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom );
isCreation = false;
- }
+ }
anIsOk = true;
}
if (myGrpTypeId == 2) // group on filter
// The main shape of the group
GEOM::GEOM_Object_var aGroupMainShape;
- if (aGeomGroup->GetType() == 37) {
+ if (aGeomGroup->GetType() == 37)
+ {
GEOM::GEOM_IGroupOperations_ptr anOp =
- SMESH::GetGEOMGen()->GetIGroupOperations();
- aGroupMainShape = anOp->GetMainShape(aGeomGroup);
+ SMESH::GetGEOMGen( aGeomGroup )->GetIGroupOperations();
+ aGroupMainShape = anOp->GetMainShape( aGeomGroup );
// aGroupMainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
}
- else {
+ else
+ {
aGroupMainShape = aGeomGroup;
aGroupMainShape->Register();
}
QListWidgetItem* anItem = 0;
QList<QListWidgetItem*> listItemsToSel;
- if (myCurrentLineEdit == 0) {
+ if ( myCurrentLineEdit == 0 )
+ {
//if (aNbSel != 1) { myIsBusy = false; return; }
QString aListStr = "";
int aNbItems = 0;
onListSelectionChanged();
listItemsToSel.clear();
}
- } else if (myCurrentLineEdit == mySubMeshLine) {
+ }
+ else if ( myCurrentLineEdit == mySubMeshLine )
+ {
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
SALOME_ListIO aList;
myIsBusy = false;
onListSelectionChanged();
- } else if (myCurrentLineEdit == myGroupLine) {
+ }
+ else if ( myCurrentLineEdit == myGroupLine )
+ {
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
myIsBusy = false;
onListSelectionChanged();
- } else if (myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1) {
+ }
+ else if ( myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1 )
+ {
GEOM::GEOM_IGroupOperations_ptr aGroupOp =
- SMESH::GetGEOMGen()->GetIGroupOperations();
+ SMESH::GetGEOMGen( myGeomObjects[0] )->GetIGroupOperations();
SMESH::ElementType aGroupType = SMESH::ALL;
switch(aGroupOp->GetType(myGeomObjects[0])) {
case GEOM::COMPOUND: break;
default: return SMESH::ALL;
}
- GEOM::GEOM_IShapesOperations_wrap aShapeOp =
- SMESH::GetGEOMGen()->GetIShapesOperations();
+ GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( geom );
+ GEOM::GEOM_IShapesOperations_wrap aShapeOp = geomGen->GetIShapesOperations();
- if ( geom->GetType() == 37 ) { // geom group
- GEOM::GEOM_IGroupOperations_ptr aGroupOp =
- SMESH::GetGEOMGen()->GetIGroupOperations();
+ if ( geom->GetType() == 37 ) // geom group
+ {
+ GEOM::GEOM_IGroupOperations_ptr aGroupOp = geomGen->GetIGroupOperations();
if ( !aGroupOp->_is_nil() ) {
// mainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
GEOM::GEOM_Object_var mainShape = aGroupOp->GetMainShape( geom );
}
}
}
- else if ( !aShapeOp->_is_nil() ) { // just a compoud shape
+ else if ( !aShapeOp->_is_nil() ) // just a compoud shape
+ {
GEOM::ListOfLong_var ids = aShapeOp->SubShapeAllIDs( geom, GEOM::SHAPE, false );
if ( ids->length() ) {
GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( geom, ids[0] );
else if (aGEOMs.count() > 1)
{
// create a GEOM group
- GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
- if (!geomGen->_is_nil()) {
- GEOM::GEOM_IGroupOperations_ptr op =
- geomGen->GetIGroupOperations();
- if (!op->_is_nil()) {
+ GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( mainGeom );
+ if ( !geomGen->_is_nil() ) {
+ GEOM::GEOM_IGroupOperations_ptr op = geomGen->GetIGroupOperations();
+ if ( !op->_is_nil() )
+ {
// check and add all selected GEOM objects: they must be
// a sub-shapes of the main GEOM and must be of one type
int iSubSh = 0;
}
else
{
- GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
+ GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
- if (geomGen->_is_nil())
+ GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( aMeshShape );
+ if ( geomGen->_is_nil() )
return;
- GEOM::GEOM_IShapesOperations_wrap aShapesOp =
- geomGen->GetIShapesOperations();
- if (aShapesOp->_is_nil() )
+ GEOM::GEOM_IShapesOperations_wrap aShapesOp = geomGen->GetIShapesOperations();
+ if ( aShapesOp->_is_nil() )
return;
TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
std::map<int, GEOM::GEOM_Object_wrap> aGeomObjectsMap;
GEOM::GEOM_Object_wrap aGeomObject;
- GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
-
for ( int i = 0; i < aListId.count(); i++ )
{
aGeomObject = // received object need UnRegister()!
}
else if (aNumberOfGO > 1)
{
- GEOM::GEOM_IGroupOperations_ptr aGroupOp =
- geomGen->GetIGroupOperations();
- if(aGroupOp->_is_nil())
+ GEOM::GEOM_IGroupOperations_ptr aGroupOp = geomGen->GetIGroupOperations();
+ if ( aGroupOp->_is_nil() )
return;
GEOM::ListOfGO_var aGeomObjects = new GEOM::ListOfGO();
aGeomObject = aGroupOp->CreateGroup(aMeshShape, aGroupType);
aGroupOp->UnionList(aGeomObject, aGeomObjects);
- if (!aGroupOp->IsDone())
+ if ( !aGroupOp->IsDone() )
return;
}
try {
SALOME_ListIO aList;
selectionMgr()->selectedObjects(aList);
- if (!myIsMultipleAllowed && aList.Extent() != 1)
+ if ( aList.IsEmpty() || ( !myIsMultipleAllowed && aList.Extent() != 1) )
return;
SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(aList.First());