mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-06 04:44:18 +05:00
Fix for bug Bug IPAL11402 ( Group on geometry isn't editable ).
This commit is contained in:
parent
924642c836
commit
f7c91a241b
@ -1592,8 +1592,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
int nbSelectedGroups = 0;
|
int nbSelectedGroups = 0;
|
||||||
for ( ; It.More(); It.Next() )
|
for ( ; It.More(); It.Next() )
|
||||||
{
|
{
|
||||||
SMESH::SMESH_Group_var aGroup =
|
SMESH::SMESH_GroupBase_var aGroup =
|
||||||
SMESH::IObjectToInterface<SMESH::SMESH_Group>(It.Value());
|
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(It.Value());
|
||||||
if (!aGroup->_is_nil()) {
|
if (!aGroup->_is_nil()) {
|
||||||
nbSelectedGroups++;
|
nbSelectedGroups++;
|
||||||
SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, "", aGroup);
|
SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, "", aGroup);
|
||||||
@ -1602,7 +1602,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
}
|
}
|
||||||
if (nbSelectedGroups == 0)
|
if (nbSelectedGroups == 0)
|
||||||
{
|
{
|
||||||
SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, "", SMESH::SMESH_Group::_nil());
|
SMESHGUI_GroupDlg *aDlg = new SMESHGUI_GroupDlg( this, "", SMESH::SMESH_GroupBase::_nil());
|
||||||
aDlg->show();
|
aDlg->show();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -110,7 +110,7 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name,
|
|||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name,
|
SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule, const char* name,
|
||||||
SMESH::SMESH_Group_ptr theGroup, bool modal, WFlags fl)
|
SMESH::SMESH_GroupBase_ptr theGroup, bool modal, WFlags fl)
|
||||||
: QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
|
: QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
|
||||||
WStyle_Title | WStyle_SysMenu | WDestructiveClose),
|
WStyle_Title | WStyle_SysMenu | WDestructiveClose),
|
||||||
mySMESHGUI( theModule ),
|
mySMESHGUI( theModule ),
|
||||||
@ -276,6 +276,12 @@ void SMESHGUI_GroupDlg::initDialog(bool create)
|
|||||||
myGeomGroupLine->setReadOnly(true); //VSR ???
|
myGeomGroupLine->setReadOnly(true); //VSR ???
|
||||||
onSelectGeomGroup(false);
|
onSelectGeomGroup(false);
|
||||||
|
|
||||||
|
if (!create)
|
||||||
|
{
|
||||||
|
myGeomGroupBtn->setEnabled(false);
|
||||||
|
myGeomGroupLine->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
QGridLayout* wg2Layout = new QGridLayout( wg2, 2, 3, 0, 6 );
|
QGridLayout* wg2Layout = new QGridLayout( wg2, 2, 3, 0, 6 );
|
||||||
wg2Layout->addWidget(geomObject, 0, 0);
|
wg2Layout->addWidget(geomObject, 0, 0);
|
||||||
@ -366,8 +372,8 @@ void SMESHGUI_GroupDlg::initDialog(bool create)
|
|||||||
connect(myGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
connect(myGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
||||||
connect(myGeomGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
connect(myGeomGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
||||||
connect(mySelectColorGroup, SIGNAL(toggled(bool)), this, SLOT(onSelectColorGroup(bool)));
|
connect(mySelectColorGroup, SIGNAL(toggled(bool)), this, SLOT(onSelectColorGroup(bool)));
|
||||||
|
connect(myColorGroupLine, SIGNAL(textChanged(const QString&)), this, SLOT(onNbColorsChanged(const QString&)));
|
||||||
|
|
||||||
connect(aOKBtn, SIGNAL(clicked()), this, SLOT(onOK()));
|
connect(aOKBtn, SIGNAL(clicked()), this, SLOT(onOK()));
|
||||||
connect(aApplyBtn, SIGNAL(clicked()), this, SLOT(onApply()));
|
connect(aApplyBtn, SIGNAL(clicked()), this, SLOT(onApply()));
|
||||||
connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(onClose()));
|
connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(onClose()));
|
||||||
@ -419,6 +425,7 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh)
|
|||||||
/* init data from current selection */
|
/* init data from current selection */
|
||||||
myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh);
|
myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh);
|
||||||
myGroup = SMESH::SMESH_Group::_nil();
|
myGroup = SMESH::SMESH_Group::_nil();
|
||||||
|
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
|
||||||
|
|
||||||
myActor = SMESH::FindActorByObject(myMesh);
|
myActor = SMESH::FindActorByObject(myMesh);
|
||||||
SMESH::SetPickable(myActor);
|
SMESH::SetPickable(myActor);
|
||||||
@ -442,15 +449,17 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh)
|
|||||||
// function : Init()
|
// function : Init()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void SMESHGUI_GroupDlg::init (SMESH::SMESH_Group_ptr theGroup)
|
void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup)
|
||||||
{
|
{
|
||||||
myMesh = theGroup->GetMesh();
|
myMesh = theGroup->GetMesh();
|
||||||
myGroup = SMESH::SMESH_Group::_duplicate(theGroup);
|
|
||||||
|
|
||||||
myActor = SMESH::FindActorByObject(myMesh);
|
myName->setText(theGroup->GetName());
|
||||||
if ( !myActor )
|
myName->home(false);
|
||||||
myActor = SMESH::FindActorByObject(myGroup);
|
|
||||||
SMESH::SetPickable(myActor);
|
myColorGroupLine->setText(QString::number(theGroup->GetColorNumber()));
|
||||||
|
myColorGroupLine->home(false);
|
||||||
|
|
||||||
|
myMeshGroupLine->setText(theGroup->GetName());
|
||||||
|
|
||||||
int aType = 0;
|
int aType = 0;
|
||||||
switch(theGroup->GetType()) {
|
switch(theGroup->GetType()) {
|
||||||
@ -459,31 +468,61 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_Group_ptr theGroup)
|
|||||||
case SMESH::FACE: aType = 2; break;
|
case SMESH::FACE: aType = 2; break;
|
||||||
case SMESH::VOLUME: aType = 3; break;
|
case SMESH::VOLUME: aType = 3; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
myName->setText(myGroup->GetName());
|
|
||||||
myName->home(false);
|
|
||||||
|
|
||||||
myColorGroupLine->setText(QString::number(myGroup->GetColorNumber()));
|
|
||||||
myColorGroupLine->home(false);
|
|
||||||
|
|
||||||
myMeshGroupLine->setText(myGroup->GetName());
|
|
||||||
|
|
||||||
myCurrentLineEdit = 0;
|
|
||||||
myTypeGroup->setButton(aType);
|
myTypeGroup->setButton(aType);
|
||||||
myElements->clear();
|
|
||||||
setSelectionMode(aType);
|
myGroup = SMESH::SMESH_Group::_narrow( theGroup );
|
||||||
myTypeId = aType;
|
|
||||||
|
|
||||||
myIdList.clear();
|
if ( !myGroup->_is_nil() )
|
||||||
if (!theGroup->IsEmpty()) {
|
{
|
||||||
SMESH::long_array_var anElements = myGroup->GetListOfID();
|
myGrpTypeGroup->setButton(0);
|
||||||
int k = anElements->length();
|
onGrpTypeChanged(0);
|
||||||
for (int i = 0; i < k; i++) {
|
|
||||||
myIdList.append(anElements[i]);
|
myActor = SMESH::FindActorByObject(myMesh);
|
||||||
myElements->insertItem(QString::number(anElements[i]));
|
if ( !myActor )
|
||||||
|
myActor = SMESH::FindActorByObject(myGroup);
|
||||||
|
SMESH::SetPickable(myActor);
|
||||||
|
|
||||||
|
myCurrentLineEdit = 0;
|
||||||
|
myElements->clear();
|
||||||
|
setSelectionMode(aType);
|
||||||
|
myTypeId = aType;
|
||||||
|
|
||||||
|
myIdList.clear();
|
||||||
|
if (!myGroup->IsEmpty()) {
|
||||||
|
SMESH::long_array_var anElements = myGroup->GetListOfID();
|
||||||
|
int k = anElements->length();
|
||||||
|
for (int i = 0; i < k; i++) {
|
||||||
|
myIdList.append(anElements[i]);
|
||||||
|
myElements->insertItem(QString::number(anElements[i]));
|
||||||
|
}
|
||||||
|
myElements->selectAll(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow( theGroup );
|
||||||
|
|
||||||
|
if ( !myGroupOnGeom->_is_nil() )
|
||||||
|
{
|
||||||
|
myGrpTypeGroup->setButton(1);
|
||||||
|
onGrpTypeChanged(1);
|
||||||
|
|
||||||
|
myActor = SMESH::FindActorByObject(myMesh);
|
||||||
|
if ( !myActor )
|
||||||
|
myActor = SMESH::FindActorByObject(myGroup);
|
||||||
|
SMESH::SetPickable(myActor);
|
||||||
|
|
||||||
|
QString aShapeName("");
|
||||||
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
|
GEOM::GEOM_Object_var aGroupShape = myGroupOnGeom->GetShape();
|
||||||
|
if (!aGroupShape->_is_nil())
|
||||||
|
{
|
||||||
|
_PTR(SObject) aGroupShapeSO = aStudy->FindObjectID(aGroupShape->GetStudyEntry());
|
||||||
|
aShapeName = aGroupShapeSO->GetName().c_str();
|
||||||
|
}
|
||||||
|
myGeomGroupLine->setText( aShapeName );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
myElements->selectAll(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -497,7 +536,10 @@ void SMESHGUI_GroupDlg::updateButtons()
|
|||||||
if (myGrpTypeId == 0)
|
if (myGrpTypeId == 0)
|
||||||
enable = !myName->text().stripWhiteSpace().isEmpty() && myElements->count() > 0;
|
enable = !myName->text().stripWhiteSpace().isEmpty() && myElements->count() > 0;
|
||||||
else if (myGrpTypeId == 1)
|
else if (myGrpTypeId == 1)
|
||||||
enable = !myName->text().stripWhiteSpace().isEmpty() && !CORBA::is_nil( myGeomGroup );
|
{
|
||||||
|
bool isEditMode = !CORBA::is_nil( myGroupOnGeom );
|
||||||
|
enable = !myName->text().stripWhiteSpace().isEmpty() && (!CORBA::is_nil( myGeomGroup ) || isEditMode);
|
||||||
|
}
|
||||||
QPushButton* aBtn;
|
QPushButton* aBtn;
|
||||||
aBtn = (QPushButton*) child("ok", "QPushButton");
|
aBtn = (QPushButton*) child("ok", "QPushButton");
|
||||||
if (aBtn) aBtn->setEnabled(enable);
|
if (aBtn) aBtn->setEnabled(enable);
|
||||||
@ -514,6 +556,15 @@ void SMESHGUI_GroupDlg::onNameChanged (const QString& text)
|
|||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onNbColorsChanged()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_GroupDlg::onNbColorsChanged (const QString& text)
|
||||||
|
{
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : onTypeChanged()
|
// function : onTypeChanged()
|
||||||
// purpose : Group elements type radio button management
|
// purpose : Group elements type radio button management
|
||||||
@ -634,11 +685,7 @@ bool SMESHGUI_GroupDlg::onApply()
|
|||||||
|
|
||||||
/* init for next operation */
|
/* init for next operation */
|
||||||
myName->setText("");
|
myName->setText("");
|
||||||
|
|
||||||
myColorGroupLine->setText("");
|
myColorGroupLine->setText("");
|
||||||
|
|
||||||
/* init for next operation */
|
|
||||||
myName->setText("");
|
|
||||||
myElements->clear();
|
myElements->clear();
|
||||||
myGroup = SMESH::SMESH_Group::_nil();
|
myGroup = SMESH::SMESH_Group::_nil();
|
||||||
|
|
||||||
@ -687,40 +734,50 @@ bool SMESHGUI_GroupDlg::onApply()
|
|||||||
return true;
|
return true;
|
||||||
} else if (myGrpTypeId == 1 &&
|
} else if (myGrpTypeId == 1 &&
|
||||||
!myName->text().stripWhiteSpace().isEmpty() &&
|
!myName->text().stripWhiteSpace().isEmpty() &&
|
||||||
!CORBA::is_nil(myGeomGroup))
|
(!CORBA::is_nil(myGeomGroup) || !CORBA::is_nil(myGroupOnGeom)))
|
||||||
{
|
{
|
||||||
SMESH::ElementType aType = SMESH::ALL;
|
if (myGroupOnGeom->_is_nil()) {
|
||||||
switch (myTypeId) {
|
SMESH::ElementType aType = SMESH::ALL;
|
||||||
case 0: aType = SMESH::NODE; break;
|
switch (myTypeId) {
|
||||||
case 1: aType = SMESH::EDGE; break;
|
case 0: aType = SMESH::NODE; break;
|
||||||
case 2: aType = SMESH::FACE; break;
|
case 1: aType = SMESH::EDGE; break;
|
||||||
case 3: aType = SMESH::VOLUME; break;
|
case 2: aType = SMESH::FACE; break;
|
||||||
|
case 3: aType = SMESH::VOLUME; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||||
|
GEOM::GEOM_IGroupOperations_var aGroupOp =
|
||||||
|
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
||||||
|
|
||||||
|
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, myName->text(),myGeomGroup);
|
||||||
|
|
||||||
|
int aColorNumber = myColorGroupLine->text().toInt();
|
||||||
|
myGroupOnGeom->SetColorNumber(aColorNumber);
|
||||||
|
|
||||||
|
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroupOnGeom);
|
||||||
|
|
||||||
|
SMESH::setFileName (aMeshGroupSO, myColorGroupLine->text());
|
||||||
|
|
||||||
|
SMESH::setFileType (aMeshGroupSO,"COULEURGROUP");
|
||||||
|
|
||||||
|
/* init for next operation */
|
||||||
|
myName->setText("");
|
||||||
|
myColorGroupLine->setText("");
|
||||||
|
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
{
|
||||||
GEOM::GEOM_IGroupOperations_var aGroupOp =
|
myGroupOnGeom->SetName(myName->text());
|
||||||
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
|
||||||
|
int aColorNumber = myColorGroupLine->text().toInt();
|
||||||
SMESH::SMESH_GroupOnGeom_var aGroupOnGeom =
|
myGroupOnGeom->SetColorNumber(aColorNumber);
|
||||||
myMesh->CreateGroupFromGEOM(aType, myName->text(),myGeomGroup);
|
}
|
||||||
|
|
||||||
int aColorNumber = myColorGroupLine->text().toInt();
|
|
||||||
aGroupOnGeom->SetColorNumber(aColorNumber);
|
|
||||||
|
|
||||||
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(aGroupOnGeom);
|
|
||||||
|
|
||||||
SMESH::setFileName (aMeshGroupSO, myColorGroupLine->text());
|
|
||||||
|
|
||||||
SMESH::setFileType (aMeshGroupSO,"COULEURGROUP");
|
|
||||||
|
|
||||||
mySMESHGUI->updateObjBrowser(true);
|
mySMESHGUI->updateObjBrowser(true);
|
||||||
mySelectionMgr->clearSelected();
|
mySelectionMgr->clearSelected();
|
||||||
/* init for next operation */
|
|
||||||
myName->setText("");
|
|
||||||
myColorGroupLine->setText("");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -825,7 +882,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
|||||||
myGeomGroupLine->setEnabled(true);
|
myGeomGroupLine->setEnabled(true);
|
||||||
updateButtons();
|
updateButtons();
|
||||||
} else {
|
} else {
|
||||||
SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(IO);
|
SMESH::SMESH_GroupBase_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
|
||||||
if (aGroup->_is_nil())
|
if (aGroup->_is_nil())
|
||||||
{
|
{
|
||||||
myIsBusy = false;
|
myIsBusy = false;
|
||||||
@ -958,6 +1015,8 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
|||||||
if (!myActor) {
|
if (!myActor) {
|
||||||
if (!myGroup->_is_nil())
|
if (!myGroup->_is_nil())
|
||||||
myActor = SMESH::FindActorByObject(myGroup);
|
myActor = SMESH::FindActorByObject(myGroup);
|
||||||
|
else if(!myGroupOnGeom->_is_nil())
|
||||||
|
myActor = SMESH::FindActorByObject(myGroupOnGeom);
|
||||||
else
|
else
|
||||||
myActor = SMESH::FindActorByObject(myMesh);
|
myActor = SMESH::FindActorByObject(myMesh);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ public:
|
|||||||
bool modal = FALSE, WFlags fl = 0 );
|
bool modal = FALSE, WFlags fl = 0 );
|
||||||
SMESHGUI_GroupDlg( SMESHGUI*,
|
SMESHGUI_GroupDlg( SMESHGUI*,
|
||||||
const char* name,
|
const char* name,
|
||||||
SMESH::SMESH_Group_ptr theGroup,
|
SMESH::SMESH_GroupBase_ptr theGroup,
|
||||||
bool modal = FALSE, WFlags fl = 0 );
|
bool modal = FALSE, WFlags fl = 0 );
|
||||||
~SMESHGUI_GroupDlg();
|
~SMESHGUI_GroupDlg();
|
||||||
|
|
||||||
@ -102,12 +102,13 @@ private slots:
|
|||||||
void onSort();
|
void onSort();
|
||||||
|
|
||||||
void onNameChanged(const QString& text);
|
void onNameChanged(const QString& text);
|
||||||
|
void onNbColorsChanged(const QString& text);
|
||||||
void onFilterAccepted();
|
void onFilterAccepted();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initDialog(bool create);
|
void initDialog(bool create);
|
||||||
void init(SMESH::SMESH_Mesh_ptr theMesh);
|
void init(SMESH::SMESH_Mesh_ptr theMesh);
|
||||||
void init(SMESH::SMESH_Group_ptr theGroup);
|
void init(SMESH::SMESH_GroupBase_ptr theGroup);
|
||||||
void closeEvent(QCloseEvent* e);
|
void closeEvent(QCloseEvent* e);
|
||||||
void enterEvent (QEvent*);
|
void enterEvent (QEvent*);
|
||||||
void hideEvent (QHideEvent*); /* ESC key */
|
void hideEvent (QHideEvent*); /* ESC key */
|
||||||
@ -151,6 +152,7 @@ private:
|
|||||||
|
|
||||||
SMESH::SMESH_Mesh_var myMesh;
|
SMESH::SMESH_Mesh_var myMesh;
|
||||||
SMESH::SMESH_Group_var myGroup;
|
SMESH::SMESH_Group_var myGroup;
|
||||||
|
SMESH::SMESH_GroupOnGeom_var myGroupOnGeom;
|
||||||
QValueList<int> myIdList;
|
QValueList<int> myIdList;
|
||||||
GEOM::GEOM_Object_var myGeomGroup;
|
GEOM::GEOM_Object_var myGeomGroup;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user