Salome HOME
projects
/
modules
/
smesh.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix for #19201: Can't select a SHAPER result to create a group on geometry
[modules/smesh.git]
/
src
/
SMESHGUI
/
SMESHGUI_GroupDlg.cxx
diff --git
a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx
b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx
index 1425aaf2b111208d07032f6b6196acd583a7c12b..21b33c443b7e5022196c3a44633009fa7374f4a0 100644
(file)
--- a/
src/SMESHGUI/SMESHGUI_GroupDlg.cxx
+++ b/
src/SMESHGUI/SMESHGUI_GroupDlg.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-20
16
CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-20
20
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
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@
-192,7
+192,7
@@
void SMESHGUI_GroupDlg::initDialog( bool create)
QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
setWindowTitle( create ? tr( "SMESH_CREATE_GROUP_TITLE" ) : tr( "SMESH_EDIT_GROUP_TITLE" ) );
QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
setWindowTitle( create ? tr( "SMESH_CREATE_GROUP_TITLE" ) : tr( "SMESH_EDIT_GROUP_TITLE" ) );
- myHelpFileName = create ? "creating_groups
_page.html" : "editing_groups_page
.html";
+ myHelpFileName = create ? "creating_groups
.html" : "editing_groups
.html";
setSizeGripEnabled( true);
setSizeGripEnabled( true);
@@
-1055,12
+1055,11
@@
bool SMESHGUI_GroupDlg::onApply()
}
else {
SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
}
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
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;
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;
// 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();
TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)myGeomObjects[i]->GetShapeType();
- if (
i == 0
)
+ if (
i == 0
)
aGroupType = aSubShapeType;
aGroupType = aSubShapeType;
- else if (
aSubShapeType != aGroupType
) {
+ else if (
aSubShapeType != aGroupType
) {
aGroupType = TopAbs_SHAPE;
break;
}
aGroupType = TopAbs_SHAPE;
break;
}
@@
-1083,6
+1083,8
@@
bool SMESHGUI_GroupDlg::onApply()
GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(aMeshShape, aGroupType);
GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(aMeshShape, aGroupType);
+ if ( aGroupVar->_is_nil() )
+ return false;
op->UnionList(aGroupVar, myGeomObjects);
if (op->IsDone()) {
op->UnionList(aGroupVar, myGeomObjects);
if (op->IsDone()) {
@@
-1106,7
+1108,7
@@
bool SMESHGUI_GroupDlg::onApply()
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom );
isCreation = false;
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom );
isCreation = false;
- }
+ }
anIsOk = true;
}
if (myGrpTypeId == 2) // group on filter
anIsOk = true;
}
if (myGrpTypeId == 2) // group on filter
@@
-1120,7
+1122,7
@@
bool SMESHGUI_GroupDlg::onApply()
myGroupOnFilter = myMesh->CreateGroupFromFilter(aType,
myName->text().toUtf8(),
myGroupOnFilter = myMesh->CreateGroupFromFilter(aType,
myName->text().toUtf8(),
- myFilter);
+
myFilter);
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnFilter );
isCreation = true;
}
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnFilter );
isCreation = true;
}
@@
-1192,7
+1194,7
@@
bool SMESHGUI_GroupDlg::onApply()
anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break;
break;
}
anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break;
break;
}
- // update a visible group accoding to a changed contents
+ // update a visible group acco
r
ding to a changed contents
if ( !isConversion && anActor->GetVisibility() )
{
SMESH::Update( anIO, true );
if ( !isConversion && anActor->GetVisibility() )
{
SMESH::Update( anIO, true );
@@
-1400,9
+1402,11
@@
void SMESHGUI_GroupDlg::onObjectSelectionChanged()
SALOME_ListIteratorOfListIO anIt (aList);
for (; anIt.More(); anIt.Next())
{
SALOME_ListIteratorOfListIO anIt (aList);
for (; anIt.More(); anIt.Next())
{
- aGeomGroup = GEOMBase::ConvertIOinGEOMObject(anIt.Value());
-
+ CORBA::Object_var aGroupObj = SMESH::IObjectToObject(anIt.Value());
+ if (CORBA::is_nil(aGroupObj))
+ continue;
// Check if the object is a geometry group
// Check if the object is a geometry group
+ aGeomGroup = GEOM::GEOM_Object::_narrow(aGroupObj);
if (CORBA::is_nil(aGeomGroup))
continue;
if (CORBA::is_nil(aGeomGroup))
continue;
@@
-1410,18
+1414,21
@@
void SMESHGUI_GroupDlg::onObjectSelectionChanged()
// The main shape of the group
GEOM::GEOM_Object_var aGroupMainShape;
// The main shape of the group
GEOM::GEOM_Object_var aGroupMainShape;
- if (aGeomGroup->GetType() == 37) {
+ if (aGeomGroup->GetType() == 37)
+ {
GEOM::GEOM_IGroupOperations_wrap anOp =
GEOM::GEOM_IGroupOperations_wrap 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
}
// aGroupMainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
}
- else {
+ else
+ {
aGroupMainShape = aGeomGroup;
aGroupMainShape->Register();
}
aGroupMainShape = aGeomGroup;
aGroupMainShape->Register();
}
+ CORBA::String_var entry = aGroupMainShape->GetStudyEntry();
_PTR(SObject) aGroupMainShapeSO =
_PTR(SObject) aGroupMainShapeSO =
- SMESH::getStudy()->FindObjectID(
aGroupMainShape->GetStudyEntry()
);
+ SMESH::getStudy()->FindObjectID(
entry.in()
);
_PTR(SObject) anObj, aRef;
bool isRefOrSubShape = false;
_PTR(SObject) anObj, aRef;
bool isRefOrSubShape = false;
@@
-1445,10
+1452,10
@@
void SMESHGUI_GroupDlg::onObjectSelectionChanged()
myGeomObjects->length(i);
if ( i == 0 )
myGeomObjects->length(i);
if ( i == 0 )
-
{
-
myIsBusy = false;
-
return;
-
}
+ {
+ myIsBusy = false;
+ return;
+ }
aNbSel = i;
}
aNbSel = i;
}
@@
-1866,7
+1873,8
@@
void SMESHGUI_GroupDlg::onAdd()
QListWidgetItem* anItem = 0;
QList<QListWidgetItem*> listItemsToSel;
QListWidgetItem* anItem = 0;
QList<QListWidgetItem*> listItemsToSel;
- if (myCurrentLineEdit == 0) {
+ if ( myCurrentLineEdit == 0 )
+ {
//if (aNbSel != 1) { myIsBusy = false; return; }
QString aListStr = "";
int aNbItems = 0;
//if (aNbSel != 1) { myIsBusy = false; return; }
QString aListStr = "";
int aNbItems = 0;
@@
-1909,7
+1917,9
@@
void SMESHGUI_GroupDlg::onAdd()
onListSelectionChanged();
listItemsToSel.clear();
}
onListSelectionChanged();
listItemsToSel.clear();
}
- } else if (myCurrentLineEdit == mySubMeshLine) {
+ }
+ else if ( myCurrentLineEdit == mySubMeshLine )
+ {
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
SALOME_ListIO aList;
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
SALOME_ListIO aList;
@@
-1957,7
+1967,9
@@
void SMESHGUI_GroupDlg::onAdd()
myIsBusy = false;
onListSelectionChanged();
myIsBusy = false;
onListSelectionChanged();
- } else if (myCurrentLineEdit == myGroupLine) {
+ }
+ else if ( myCurrentLineEdit == myGroupLine )
+ {
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
@@
-1999,9
+2011,11
@@
void SMESHGUI_GroupDlg::onAdd()
myIsBusy = false;
onListSelectionChanged();
myIsBusy = false;
onListSelectionChanged();
- } else if (myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1) {
+ }
+ else if ( myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1 )
+ {
GEOM::GEOM_IGroupOperations_wrap aGroupOp =
GEOM::GEOM_IGroupOperations_wrap aGroupOp =
- SMESH::GetGEOMGen()->GetIGroupOperations();
+ SMESH::GetGEOMGen(
myGeomObjects[0]
)->GetIGroupOperations();
SMESH::ElementType aGroupType = SMESH::ALL;
switch(aGroupOp->GetType(myGeomObjects[0])) {
SMESH::ElementType aGroupType = SMESH::ALL;
switch(aGroupOp->GetType(myGeomObjects[0])) {
@@
-2303,7
+2317,7
@@
void SMESHGUI_GroupDlg::onHelp()
//=================================================================================
// function : SMESHGUI_GroupDlg::onDeactivate
//=================================================================================
// function : SMESHGUI_GroupDlg::onDeactivate
-// purpose : SLOT called when dialog must be deativated
+// purpose : SLOT called when dialog must be dea
c
tivated
//=================================================================================
void SMESHGUI_GroupDlg::onDeactivate()
{
//=================================================================================
void SMESHGUI_GroupDlg::onDeactivate()
{