BUG: SMESH::GetGEOMGen() returns GEOM_Engine instead of SHAPERSTUDY

1) GetGEOMGen() -> GetGEOMGen( GEOM::GEOM_Object_ptr go )
2) some formatting (whitespace changes)
This commit is contained in:
eap 2020-01-15 16:12:51 +03:00
parent 2b3c553f4f
commit 07ac4da8b2
8 changed files with 65 additions and 58 deletions

View File

@ -1251,8 +1251,8 @@ void SMESHGUI_BaseComputeOp::stopOperation()
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;

View File

@ -91,9 +91,6 @@ GetAllFields(const QList< QPair< SMESH::SMESH_IDSource_var, QString > >& meshes,
{
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 )
{
@ -109,6 +106,9 @@ GetAllFields(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 )
{

View File

@ -44,16 +44,12 @@
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,
@ -155,14 +151,18 @@ namespace SMESH
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();
}

View File

@ -45,7 +45,7 @@ class QString;
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 );
@ -53,7 +53,7 @@ namespace SMESH
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 );

View File

@ -1055,12 +1055,11 @@ bool SMESHGUI_GroupDlg::onApply()
}
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;
@ -1071,11 +1070,12 @@ bool SMESHGUI_GroupDlg::onApply()
// 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;
}
@ -1106,7 +1106,7 @@ bool SMESHGUI_GroupDlg::onApply()
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom );
isCreation = false;
}
}
anIsOk = true;
}
if (myGrpTypeId == 2) // group on filter
@ -1410,13 +1410,15 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
// 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();
}
@ -1867,7 +1869,8 @@ void SMESHGUI_GroupDlg::onAdd()
QListWidgetItem* anItem = 0;
QList<QListWidgetItem*> listItemsToSel;
if (myCurrentLineEdit == 0) {
if ( myCurrentLineEdit == 0 )
{
//if (aNbSel != 1) { myIsBusy = false; return; }
QString aListStr = "";
int aNbItems = 0;
@ -1910,7 +1913,9 @@ void SMESHGUI_GroupDlg::onAdd()
onListSelectionChanged();
listItemsToSel.clear();
}
} else if (myCurrentLineEdit == mySubMeshLine) {
}
else if ( myCurrentLineEdit == mySubMeshLine )
{
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
SALOME_ListIO aList;
@ -1958,7 +1963,9 @@ void SMESHGUI_GroupDlg::onAdd()
myIsBusy = false;
onListSelectionChanged();
} else if (myCurrentLineEdit == myGroupLine) {
}
else if ( myCurrentLineEdit == myGroupLine )
{
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
@ -2000,9 +2007,11 @@ void SMESHGUI_GroupDlg::onAdd()
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])) {

View File

@ -220,12 +220,12 @@ static SMESH::ElementType elementType(GEOM::GEOM_Object_var geom)
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 );
@ -236,7 +236,8 @@ static SMESH::ElementType elementType(GEOM::GEOM_Object_var 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] );

View File

@ -1854,11 +1854,11 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess, QStringList& theEntryList
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;

View File

@ -318,14 +318,14 @@ void SMESHGUI_ShapeByMeshOp::commitOperation()
}
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;
@ -333,8 +333,6 @@ void SMESHGUI_ShapeByMeshOp::commitOperation()
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()!
@ -362,9 +360,8 @@ void SMESHGUI_ShapeByMeshOp::commitOperation()
}
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();
@ -379,7 +376,7 @@ void SMESHGUI_ShapeByMeshOp::commitOperation()
aGeomObject = aGroupOp->CreateGroup(aMeshShape, aGroupType);
aGroupOp->UnionList(aGeomObject, aGeomObjects);
if (!aGroupOp->IsDone())
if ( !aGroupOp->IsDone() )
return;
}
@ -419,7 +416,7 @@ void SMESHGUI_ShapeByMeshOp::onSelectionDone()
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());