mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-27 09:50:34 +05:00
Mesh module improvement related to selection of geometrical objects in mesh group and sub-mesh creation GUI.
This commit is contained in:
parent
ac1bc3bab0
commit
158db6afbf
@ -187,6 +187,14 @@ module SMESH
|
||||
in string theGeomName)
|
||||
raises ( SALOME::SALOME_Exception );
|
||||
|
||||
/*!
|
||||
* Return geometrical object the given element is built on.
|
||||
* The returned geometrical object not published in study by this method.
|
||||
*/
|
||||
GEOM::GEOM_Object FindGeometryByMeshElement( in SMESH_Mesh theMesh,
|
||||
in long theElementID)
|
||||
raises ( SALOME::SALOME_Exception );
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "SMESHGUI_GroupDlg.h"
|
||||
#include "SMESHGUI_FilterDlg.h"
|
||||
#include "SMESHGUI_ShapeByMeshDlg.h"
|
||||
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
@ -39,7 +40,9 @@
|
||||
|
||||
#include "SMESH_TypeFilter.hxx"
|
||||
#include "SMESH_Actor.h"
|
||||
|
||||
#include "GEOMBase.h"
|
||||
#include "GEOM_SelectionFilter.h"
|
||||
|
||||
#include "SUIT_Desktop.h"
|
||||
#include "SUIT_ResourceMgr.h"
|
||||
@ -47,6 +50,8 @@
|
||||
#include "SUIT_MessageBox.h"
|
||||
|
||||
#include "SalomeApp_Tools.h"
|
||||
#include "SalomeApp_Application.h"
|
||||
#include "SalomeApp_Study.h"
|
||||
#include "LightApp_Application.h"
|
||||
#include "SALOMEDSClient_Study.hxx"
|
||||
#include "SALOME_ListIO.hxx"
|
||||
@ -62,11 +67,13 @@
|
||||
|
||||
// QT Includes
|
||||
#include <qbuttongroup.h>
|
||||
#include <qcursor.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qhbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qtoolbutton.h>
|
||||
#include <qradiobutton.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qlayout.h>
|
||||
@ -147,6 +154,11 @@ void SMESHGUI_GroupDlg::initDialog(bool create)
|
||||
myCreate = create;
|
||||
myCurrentLineEdit = 0;
|
||||
|
||||
myShapeByMeshOp = 0;
|
||||
myGeomPopup = 0;
|
||||
myGeomObjects = new GEOM::ListOfGO();
|
||||
myGeomObjects->length(0);
|
||||
|
||||
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||
|
||||
if (create) {
|
||||
@ -278,19 +290,19 @@ void SMESHGUI_GroupDlg::initDialog(bool create)
|
||||
/***************************************************************/
|
||||
QLabel* geomObject = new QLabel(wg2, "geometry object label");
|
||||
geomObject->setText(tr("SMESH_OBJECT_GEOM"));
|
||||
myGeomGroupBtn = new QPushButton(wg2, "geometry group button");
|
||||
myGeomGroupBtn->setText("");
|
||||
myGeomGroupBtn->setPixmap(image0);
|
||||
myGeomGroupBtn = new QToolButton(wg2, "geometry group button");
|
||||
myGeomGroupBtn->setIconSet( QIconSet(image0) );
|
||||
myGeomGroupBtn->setToggleButton(true);
|
||||
myGeomGroupLine = new QLineEdit(wg2, "geometry group line");
|
||||
myGeomGroupLine->setReadOnly(true); //VSR ???
|
||||
onSelectGeomGroup(false);
|
||||
|
||||
|
||||
if (!create)
|
||||
{
|
||||
myGeomGroupBtn->setEnabled(false);
|
||||
myGeomGroupLine->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
QGridLayout* wg2Layout = new QGridLayout( wg2, 2, 3, 0, 6 );
|
||||
wg2Layout->addWidget(geomObject, 0, 0);
|
||||
@ -378,7 +390,7 @@ void SMESHGUI_GroupDlg::initDialog(bool create)
|
||||
connect(mySelectGroup, SIGNAL(toggled(bool)), this, SLOT(onSelectGroup(bool)));
|
||||
connect(mySubMeshBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
||||
connect(myGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
||||
connect(myGeomGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
||||
connect(myGeomGroupBtn, SIGNAL(toggled(bool)), this, SLOT(onGeomSelectionButton(bool)));
|
||||
connect(mySelectColorGroup, SIGNAL(toggled(bool)), this, SLOT(onSelectColorGroup(bool)));
|
||||
connect(myColorSpinBox, SIGNAL(valueChanged(const QString&)), this, SLOT(onNbColorsChanged(const QString&)));
|
||||
|
||||
@ -395,7 +407,9 @@ void SMESHGUI_GroupDlg::initDialog(bool create)
|
||||
myMeshFilter = new SMESH_TypeFilter(MESH);
|
||||
mySubMeshFilter = new SMESH_TypeFilter(SUBMESH);
|
||||
myGroupFilter = new SMESH_TypeFilter(GROUP);
|
||||
|
||||
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( mySMESHGUI->application()->activeStudy() );
|
||||
myGeomFilter = new GEOM_SelectionFilter( aStudy, true );
|
||||
|
||||
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(onDeactivate()));
|
||||
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(onClose()));
|
||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onObjectSelectionChanged()));
|
||||
@ -546,7 +560,7 @@ void SMESHGUI_GroupDlg::updateButtons()
|
||||
else if (myGrpTypeId == 1)
|
||||
{
|
||||
bool isEditMode = !CORBA::is_nil( myGroupOnGeom );
|
||||
enable = !myName->text().stripWhiteSpace().isEmpty() && (!CORBA::is_nil( myGeomGroup ) || isEditMode);
|
||||
enable = !myName->text().stripWhiteSpace().isEmpty() && (myGeomObjects->length() > 0 || isEditMode);
|
||||
}
|
||||
QPushButton* aBtn;
|
||||
aBtn = (QPushButton*) child("ok", "QPushButton");
|
||||
@ -609,19 +623,21 @@ void SMESHGUI_GroupDlg::setSelectionMode (int theMode)
|
||||
// PAL7314
|
||||
if (myMesh->_is_nil())
|
||||
return;
|
||||
|
||||
if (mySelectionMode != theMode) {
|
||||
// [PAL10408] mySelectionMgr->clearSelected();
|
||||
mySelectionMgr->clearFilters();
|
||||
SMESH::SetPointRepresentation(false);
|
||||
if (myActor)
|
||||
myActor->SetPointRepresentation(false);
|
||||
else
|
||||
SMESH::SetPointRepresentation(false);
|
||||
if (theMode < 4) {
|
||||
switch (theMode) {
|
||||
case 0:
|
||||
if (myActor)
|
||||
myActor->SetPointRepresentation(true);
|
||||
else
|
||||
SMESH::SetPointRepresentation(true);
|
||||
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
||||
myActor->SetPointRepresentation(true);
|
||||
else
|
||||
SMESH::SetPointRepresentation(true);
|
||||
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
||||
aViewWindow->SetSelectionMode(NodeSelection);
|
||||
break;
|
||||
case 1:
|
||||
@ -643,11 +659,14 @@ void SMESHGUI_GroupDlg::setSelectionMode (int theMode)
|
||||
mySelectionMgr->installFilter(myGroupFilter);
|
||||
else if (theMode == 6)
|
||||
mySelectionMgr->installFilter(myMeshFilter);
|
||||
else if (theMode == 7)
|
||||
mySelectionMgr->installFilter(myGeomFilter);
|
||||
|
||||
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
||||
aViewWindow->SetSelectionMode(ActorSelection);
|
||||
}
|
||||
mySelectionMode = theMode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -742,7 +761,7 @@ bool SMESHGUI_GroupDlg::onApply()
|
||||
return true;
|
||||
} else if (myGrpTypeId == 1 &&
|
||||
!myName->text().stripWhiteSpace().isEmpty() &&
|
||||
(!CORBA::is_nil(myGeomGroup) || !CORBA::is_nil(myGroupOnGeom)))
|
||||
(myGeomObjects->length() > 0 || !CORBA::is_nil(myGroupOnGeom)))
|
||||
{
|
||||
if (myGroupOnGeom->_is_nil()) {
|
||||
SMESH::ElementType aType = SMESH::ALL;
|
||||
@ -757,7 +776,55 @@ bool SMESHGUI_GroupDlg::onApply()
|
||||
GEOM::GEOM_IGroupOperations_var aGroupOp =
|
||||
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
||||
|
||||
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, myName->text(),myGeomGroup);
|
||||
if (myGeomObjects->length() == 1)
|
||||
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, myName->text(),myGeomObjects[0]);
|
||||
else
|
||||
{
|
||||
SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
|
||||
if ( aSMESHGen->_is_nil() )
|
||||
return false;
|
||||
|
||||
// create a geometry group
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
|
||||
if (geomGen->_is_nil() || !aStudy)
|
||||
return false;
|
||||
|
||||
GEOM::GEOM_IGroupOperations_var op =
|
||||
geomGen->GetIGroupOperations(aStudy->StudyId());
|
||||
if (op->_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 < myGeomObjects->length(); i++)
|
||||
{
|
||||
TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)myGeomObjects[i]->GetShapeType();
|
||||
if (i == 0)
|
||||
aGroupType = aSubShapeType;
|
||||
else if (aSubShapeType != aGroupType)
|
||||
{
|
||||
aGroupType = TopAbs_SHAPE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
|
||||
GEOM::GEOM_Object_var aGroupVar = op->CreateGroup(aMeshShape, aGroupType);
|
||||
op->UnionList(aGroupVar, myGeomObjects);
|
||||
|
||||
if (op->IsDone()) {
|
||||
// publish the GEOM group in study
|
||||
QString aNewGeomGroupName ("Auto_group_for_");
|
||||
aNewGeomGroupName += myName->text();
|
||||
SALOMEDS::SObject_var aNewGroupSO =
|
||||
geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGroupVar, aNewGeomGroupName, aMeshShape);
|
||||
}
|
||||
|
||||
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, myName->text(), aGroupVar);
|
||||
}
|
||||
|
||||
int aColorNumber = myColorSpinBox->value();
|
||||
myGroupOnGeom->SetColorNumber(aColorNumber);
|
||||
@ -834,7 +901,9 @@ void SMESHGUI_GroupDlg::onListSelectionChanged()
|
||||
void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
||||
{
|
||||
if ( myIsBusy || !isEnabled()) return;
|
||||
myIsBusy = true;
|
||||
if (myCurrentLineEdit == myGeomGroupLine && !myGeomGroupBtn->isOn()) return;
|
||||
|
||||
myIsBusy = true;
|
||||
|
||||
SALOME_ListIO aList;
|
||||
mySelectionMgr->selectedObjects( aList );
|
||||
@ -855,6 +924,8 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
||||
myGeomGroupBtn->setEnabled(false);
|
||||
myGeomGroupLine->setEnabled(false);
|
||||
myGeomGroupLine->setText("");
|
||||
if (myGeomGroupBtn->isOn())
|
||||
myGeomGroupBtn->setOn(false);
|
||||
if (!myCreate)
|
||||
myName->setText("");
|
||||
|
||||
@ -864,6 +935,7 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
||||
myGroup = SMESH::SMESH_Group::_nil();
|
||||
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
|
||||
myMesh = SMESH::SMESH_Mesh::_nil();
|
||||
updateGeomPopup();
|
||||
myIsBusy = false;
|
||||
return;
|
||||
}
|
||||
@ -871,10 +943,11 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
||||
|
||||
if (myCreate) {
|
||||
myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
|
||||
updateGeomPopup();
|
||||
if (myMesh->_is_nil())
|
||||
{
|
||||
myIsBusy = false;
|
||||
return;
|
||||
return;
|
||||
}
|
||||
myGroup = SMESH::SMESH_Group::_nil();
|
||||
|
||||
@ -913,86 +986,107 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
||||
if (!myCreate)
|
||||
return;
|
||||
|
||||
if (myTypeId == -1)
|
||||
onTypeChanged(0);
|
||||
else {
|
||||
myElements->clear();
|
||||
setSelectionMode(myTypeId);
|
||||
}
|
||||
if (myGrpTypeId == 0)
|
||||
{
|
||||
if (myTypeId == -1)
|
||||
onTypeChanged(0);
|
||||
else
|
||||
{
|
||||
myElements->clear();
|
||||
setSelectionMode(myTypeId);
|
||||
}
|
||||
}
|
||||
|
||||
myIsBusy = false;
|
||||
return;
|
||||
|
||||
} else if (myCurrentLineEdit == myGeomGroupLine) {
|
||||
if (aNbSel != 1) {
|
||||
myGeomGroup = GEOM::GEOM_Object::_nil();
|
||||
myIsBusy = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Boolean testResult = Standard_False;
|
||||
myGeomGroup = GEOMBase::ConvertIOinGEOMObject(aList.First(), testResult);
|
||||
|
||||
// Check if the object is a geometry group
|
||||
if (!testResult || CORBA::is_nil(myGeomGroup)) {
|
||||
myGeomGroup = GEOM::GEOM_Object::_nil();
|
||||
myIsBusy = false;
|
||||
return;
|
||||
}
|
||||
// Check if group constructed on the same shape as a mesh or on its child
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
GEOM::GEOM_IGroupOperations_var anOp =
|
||||
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
||||
|
||||
// The main shape of the group
|
||||
GEOM::GEOM_Object_var aGroupMainShape;
|
||||
if (myGeomGroup->GetType() == 37)
|
||||
aGroupMainShape = anOp->GetMainShape(myGeomGroup);
|
||||
else
|
||||
aGroupMainShape = GEOM::GEOM_Object::_duplicate(myGeomGroup);
|
||||
_PTR(SObject) aGroupMainShapeSO =
|
||||
//aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(aGroupMainShape));
|
||||
aStudy->FindObjectID(aGroupMainShape->GetStudyEntry());
|
||||
|
||||
|
||||
myGeomObjects = new GEOM::ListOfGO();
|
||||
|
||||
// The mesh SObject
|
||||
_PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
|
||||
if (!aMeshSO) {
|
||||
myGeomGroup = GEOM::GEOM_Object::_nil();
|
||||
myIsBusy = false;
|
||||
return;
|
||||
}
|
||||
_PTR(SObject) anObj, aRef;
|
||||
bool isRefOrSubShape = false;
|
||||
if (aMeshSO->FindSubObject(1, anObj) && anObj->ReferencedObject(aRef)) {
|
||||
//if (strcmp(aRef->GetID(), aGroupMainShapeSO->GetID()) == 0) {
|
||||
if (aRef->GetID() == aGroupMainShapeSO->GetID()) {
|
||||
isRefOrSubShape = true;
|
||||
} else {
|
||||
_PTR(SObject) aFather = aGroupMainShapeSO->GetFather();
|
||||
_PTR(SComponent) aComponent = aGroupMainShapeSO->GetFatherComponent();
|
||||
//while (!isRefOrSubShape && strcmp(aFather->GetID(), aComponent->GetID()) != 0) {
|
||||
while (!isRefOrSubShape && aFather->GetID() != aComponent->GetID()) {
|
||||
//if (strcmp(aRef->GetID(), aFather->GetID()) == 0)
|
||||
if (aRef->GetID() == aFather->GetID())
|
||||
isRefOrSubShape = true;
|
||||
else
|
||||
aFather = aFather->GetFather();
|
||||
}
|
||||
|
||||
if (aNbSel == 0 || !aMeshSO)
|
||||
{
|
||||
myGeomObjects->length(0);
|
||||
myIsBusy = false;
|
||||
return;
|
||||
}
|
||||
|
||||
myGeomObjects->length(aNbSel);
|
||||
|
||||
GEOM::GEOM_Object_var aGeomGroup;
|
||||
Standard_Boolean testResult;
|
||||
int i = 0;
|
||||
|
||||
SALOME_ListIteratorOfListIO anIt (aList);
|
||||
for (; anIt.More(); anIt.Next()) {
|
||||
|
||||
testResult = Standard_False;
|
||||
aGeomGroup = GEOMBase::ConvertIOinGEOMObject(anIt.Value(), testResult);
|
||||
|
||||
// Check if the object is a geometry group
|
||||
if (!testResult || CORBA::is_nil(aGeomGroup))
|
||||
continue;
|
||||
|
||||
|
||||
// Check if group constructed on the same shape as a mesh or on its child
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
GEOM::GEOM_IGroupOperations_var anOp =
|
||||
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
||||
|
||||
// The main shape of the group
|
||||
GEOM::GEOM_Object_var aGroupMainShape;
|
||||
if (aGeomGroup->GetType() == 37)
|
||||
aGroupMainShape = anOp->GetMainShape(aGeomGroup);
|
||||
else
|
||||
aGroupMainShape = GEOM::GEOM_Object::_duplicate(aGeomGroup);
|
||||
_PTR(SObject) aGroupMainShapeSO =
|
||||
//aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(aGroupMainShape));
|
||||
aStudy->FindObjectID(aGroupMainShape->GetStudyEntry());
|
||||
|
||||
_PTR(SObject) anObj, aRef;
|
||||
bool isRefOrSubShape = false;
|
||||
if (aMeshSO->FindSubObject(1, anObj) && anObj->ReferencedObject(aRef)) {
|
||||
//if (strcmp(aRef->GetID(), aGroupMainShapeSO->GetID()) == 0) {
|
||||
if (aRef->GetID() == aGroupMainShapeSO->GetID()) {
|
||||
isRefOrSubShape = true;
|
||||
} else {
|
||||
_PTR(SObject) aFather = aGroupMainShapeSO->GetFather();
|
||||
_PTR(SComponent) aComponent = aGroupMainShapeSO->GetFatherComponent();
|
||||
//while (!isRefOrSubShape && strcmp(aFather->GetID(), aComponent->GetID()) != 0) {
|
||||
while (!isRefOrSubShape && aFather->GetID() != aComponent->GetID()) {
|
||||
//if (strcmp(aRef->GetID(), aFather->GetID()) == 0)
|
||||
if (aRef->GetID() == aFather->GetID())
|
||||
isRefOrSubShape = true;
|
||||
else
|
||||
aFather = aFather->GetFather();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isRefOrSubShape)
|
||||
myGeomObjects[i++] = aGeomGroup;
|
||||
}
|
||||
if (!isRefOrSubShape) {
|
||||
myGeomGroup = GEOM::GEOM_Object::_nil();
|
||||
myIsBusy = false;
|
||||
return;
|
||||
}
|
||||
|
||||
myGeomObjects->length(i);
|
||||
if ( i == 0 )
|
||||
{
|
||||
myIsBusy = false;
|
||||
return;
|
||||
}
|
||||
|
||||
aNbSel = i;
|
||||
}
|
||||
|
||||
if(aNbSel >= 1) {
|
||||
if(aNbSel > 1) {
|
||||
if(myCurrentLineEdit == mySubMeshLine)
|
||||
aString = tr("SMESH_SUBMESH_SELECTED").arg(aNbSel);
|
||||
else if(myCurrentLineEdit == myGroupLine || myCurrentLineEdit == myGeomGroupLine)
|
||||
else if(myCurrentLineEdit == myGroupLine)
|
||||
aString = tr("SMESH_GROUP_SELECTED").arg(aNbSel);
|
||||
else if(myCurrentLineEdit == myGeomGroupLine)
|
||||
aString = tr("%1 Objects").arg(aNbSel);
|
||||
} else {
|
||||
aString = aList.First()->getName();
|
||||
}
|
||||
@ -1100,9 +1194,12 @@ void SMESHGUI_GroupDlg::onSelectGeomGroup(bool on)
|
||||
mySelectGroup->setChecked(false);
|
||||
}
|
||||
myCurrentLineEdit = myGeomGroupLine;
|
||||
setSelectionMode(7);
|
||||
updateGeomPopup();
|
||||
setSelectionMode(8);
|
||||
}
|
||||
else {
|
||||
myGeomGroupBtn->setOn(false);
|
||||
myGeomObjects->length(0);
|
||||
myGeomGroupLine->setText("");
|
||||
myCurrentLineEdit = 0;
|
||||
if (myTypeId != -1)
|
||||
@ -1146,11 +1243,6 @@ void SMESHGUI_GroupDlg::setCurrentSelection()
|
||||
myCurrentLineEdit = myGroupLine;
|
||||
onObjectSelectionChanged();
|
||||
}
|
||||
else if (send == myGeomGroupBtn) {
|
||||
myCurrentLineEdit = myGeomGroupLine;
|
||||
setSelectionMode(7);
|
||||
onObjectSelectionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1328,13 +1420,13 @@ void SMESHGUI_GroupDlg::onAdd()
|
||||
myIsBusy = false;
|
||||
onListSelectionChanged();
|
||||
|
||||
} else if (myCurrentLineEdit == myGeomGroupLine && !CORBA::is_nil(myGeomGroup)) {
|
||||
} else if (myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1) {
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
GEOM::GEOM_IGroupOperations_var aGroupOp =
|
||||
SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
|
||||
|
||||
SMESH::ElementType aGroupType = SMESH::ALL;
|
||||
switch(aGroupOp->GetType(myGeomGroup)) {
|
||||
switch(aGroupOp->GetType(myGeomObjects[0])) {
|
||||
case 7: aGroupType = SMESH::NODE; break;
|
||||
case 6: aGroupType = SMESH::EDGE; break;
|
||||
case 4: aGroupType = SMESH::FACE; break;
|
||||
@ -1345,12 +1437,12 @@ void SMESHGUI_GroupDlg::onAdd()
|
||||
if (aGroupType == aType) {
|
||||
_PTR(SObject) aGroupSO =
|
||||
//aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(myGeomGroup));
|
||||
aStudy->FindObjectID(myGeomGroup->GetStudyEntry());
|
||||
aStudy->FindObjectID(myGeomObjects[0]->GetStudyEntry());
|
||||
// Construct filter
|
||||
SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
|
||||
SMESH::Filter_var aFilter = aFilterMgr->CreateFilter();
|
||||
SMESH::BelongToGeom_var aBelongToGeom = aFilterMgr->CreateBelongToGeom();;
|
||||
aBelongToGeom->SetGeom(myGeomGroup);
|
||||
aBelongToGeom->SetGeom(myGeomObjects[0]);
|
||||
aBelongToGeom->SetShapeName(aGroupSO->GetName().c_str());
|
||||
aBelongToGeom->SetElementType(aType);
|
||||
aFilter->SetPredicate(aBelongToGeom);
|
||||
@ -1596,7 +1688,7 @@ void SMESHGUI_GroupDlg::enterEvent (QEvent*)
|
||||
//=================================================================================
|
||||
void SMESHGUI_GroupDlg::hideEvent (QHideEvent*)
|
||||
{
|
||||
if (!isMinimized())
|
||||
if (!isMinimized() && !myIsBusy)
|
||||
onClose();
|
||||
}
|
||||
|
||||
@ -1616,3 +1708,128 @@ void SMESHGUI_GroupDlg::keyPressEvent( QKeyEvent* e )
|
||||
onHelp();
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Enable showing of the popup when Geometry selection btn is clicked
|
||||
* \param enable - true to enable
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
enum { DIRECT_GEOM_INDEX = 0, GEOM_BY_MESH_INDEX };
|
||||
|
||||
void SMESHGUI_GroupDlg::updateGeomPopup()
|
||||
{
|
||||
bool enable = false;
|
||||
|
||||
if ( !myMesh->_is_nil() )
|
||||
enable = myMesh->NbEdges() > 0;
|
||||
|
||||
if ( myGeomGroupBtn )
|
||||
{
|
||||
disconnect( myGeomGroupBtn, SIGNAL( toggled(bool) ), this, SLOT( onGeomSelectionButton(bool) ));
|
||||
if ( enable ) {
|
||||
if ( !myGeomPopup ) {
|
||||
myGeomPopup = new QPopupMenu();
|
||||
myGeomPopup->insertItem( tr("DIRECT_GEOM_SELECTION"), DIRECT_GEOM_INDEX );
|
||||
myGeomPopup->insertItem( tr("GEOM_BY_MESH_ELEM_SELECTION"), GEOM_BY_MESH_INDEX );
|
||||
connect( myGeomPopup, SIGNAL( activated( int ) ), SLOT( onGeomPopup( int ) ) );
|
||||
}
|
||||
connect( myGeomGroupBtn, SIGNAL( toggled(bool) ), this, SLOT( onGeomSelectionButton(bool) ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : onGeomSelectionButton()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_GroupDlg::onGeomSelectionButton(bool isBtnOn)
|
||||
{
|
||||
if ( myGeomPopup && isBtnOn )
|
||||
{
|
||||
myCurrentLineEdit = myGeomGroupLine;
|
||||
int id = myGeomPopup->exec( QCursor::pos() );
|
||||
if (id == DIRECT_GEOM_INDEX || id == -1)
|
||||
setSelectionMode(7);
|
||||
}
|
||||
else if (!isBtnOn)
|
||||
{
|
||||
myCurrentLineEdit = 0;
|
||||
setSelectionMode(8);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : onGeomPopup()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_GroupDlg::onGeomPopup( int index )
|
||||
{
|
||||
if ( index == GEOM_BY_MESH_INDEX )
|
||||
{
|
||||
mySelectionMode = -1;
|
||||
if ( !myShapeByMeshOp ) {
|
||||
myShapeByMeshOp = new SMESHGUI_ShapeByMeshOp(true);
|
||||
connect(myShapeByMeshOp, SIGNAL(committed(SUIT_Operation*)),
|
||||
SLOT(onPublishShapeByMeshDlg(SUIT_Operation*)));
|
||||
connect(myShapeByMeshOp, SIGNAL(aborted(SUIT_Operation*)),
|
||||
SLOT(onCloseShapeByMeshDlg(SUIT_Operation*)));
|
||||
}
|
||||
// set mesh object to SMESHGUI_ShapeByMeshOp and start it
|
||||
if ( !myMesh->_is_nil() ) {
|
||||
myIsBusy = true;
|
||||
hide(); // stop processing selection
|
||||
myIsBusy = false;
|
||||
myShapeByMeshOp->setModule( mySMESHGUI );
|
||||
myShapeByMeshOp->setStudy( 0 ); // it's really necessary
|
||||
myShapeByMeshOp->SetMesh( myMesh );
|
||||
myShapeByMeshOp->start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief SLOT. Is called when Ok is pressed in SMESHGUI_ShapeByMeshDlg
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void SMESHGUI_GroupDlg::onPublishShapeByMeshDlg(SUIT_Operation* op)
|
||||
{
|
||||
if ( myShapeByMeshOp == op ) {
|
||||
mySMESHGUI->getApp()->updateObjectBrowser();
|
||||
show();
|
||||
// Select a found geometry object
|
||||
GEOM::GEOM_Object_var aGeomVar = myShapeByMeshOp->GetShape();
|
||||
if ( !aGeomVar->_is_nil() )
|
||||
{
|
||||
QString ID = aGeomVar->GetStudyEntry();
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
if ( _PTR(SObject) aGeomSO = aStudy->FindObjectID( ID.latin1() )) {
|
||||
SALOME_ListIO anIOList;
|
||||
Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject
|
||||
( aGeomSO->GetID().c_str(), "SMESH", aGeomSO->GetName().c_str() );
|
||||
anIOList.Append( anIO );
|
||||
mySelectionMgr->setSelectedObjects( anIOList, false );
|
||||
onObjectSelectionChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief SLOT. Is called when Close is pressed in SMESHGUI_ShapeByMeshDlg
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void SMESHGUI_GroupDlg::onCloseShapeByMeshDlg(SUIT_Operation* op)
|
||||
{
|
||||
if ( myShapeByMeshOp == op )
|
||||
{
|
||||
show();
|
||||
setSelectionMode(7);
|
||||
}
|
||||
}
|
||||
|
@ -45,13 +45,17 @@ class QLineEdit;
|
||||
class QButtonGroup;
|
||||
class QGroupBox;
|
||||
class QListBox;
|
||||
class QPopupMenu;
|
||||
class QPushButton;
|
||||
class QToolButton;
|
||||
class QCheckBox;
|
||||
class QWidgetStack;
|
||||
class QtxIntSpinBox;
|
||||
class SMESHGUI;
|
||||
class SMESH_Actor;
|
||||
class SMESHGUI_FilterDlg;
|
||||
class SMESHGUI_ShapeByMeshOp;
|
||||
class SUIT_Operation;
|
||||
class SVTK_Selector;
|
||||
class SVTK_ViewWindow;
|
||||
|
||||
@ -107,6 +111,12 @@ private slots:
|
||||
void onNbColorsChanged(const QString& text);
|
||||
void onFilterAccepted();
|
||||
|
||||
void onGeomPopup( int );
|
||||
void onGeomSelectionButton( bool );
|
||||
|
||||
void onPublishShapeByMeshDlg(SUIT_Operation*);
|
||||
void onCloseShapeByMeshDlg(SUIT_Operation*);
|
||||
|
||||
private:
|
||||
void initDialog(bool create);
|
||||
void init(SMESH::SMESH_Mesh_ptr theMesh);
|
||||
@ -117,6 +127,7 @@ private:
|
||||
void keyPressEvent(QKeyEvent*);
|
||||
void setSelectionMode(int theMode);
|
||||
void updateButtons();
|
||||
void updateGeomPopup();
|
||||
|
||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||
@ -150,14 +161,17 @@ private:
|
||||
QtxIntSpinBox* myColorSpinBox;
|
||||
|
||||
QCheckBox* mySelectGeomGroup;
|
||||
QPushButton* myGeomGroupBtn;
|
||||
QToolButton* myGeomGroupBtn;
|
||||
QLineEdit* myGeomGroupLine;
|
||||
QPopupMenu* myGeomPopup;
|
||||
|
||||
SMESHGUI_ShapeByMeshOp* myShapeByMeshOp;
|
||||
|
||||
SMESH::SMESH_Mesh_var myMesh;
|
||||
SMESH::SMESH_Group_var myGroup;
|
||||
SMESH::SMESH_GroupOnGeom_var myGroupOnGeom;
|
||||
QValueList<int> myIdList;
|
||||
GEOM::GEOM_Object_var myGeomGroup;
|
||||
GEOM::ListOfGO_var myGeomObjects;
|
||||
|
||||
int mySelectionMode;
|
||||
//Handle(SMESH_TypeFilter) myMeshFilter;
|
||||
@ -166,6 +180,7 @@ private:
|
||||
SUIT_SelectionFilter* myMeshFilter;
|
||||
SUIT_SelectionFilter* mySubMeshFilter;
|
||||
SUIT_SelectionFilter* myGroupFilter;
|
||||
SUIT_SelectionFilter* myGeomFilter;
|
||||
|
||||
SMESHGUI_FilterDlg* myFilterDlg;
|
||||
|
||||
|
@ -70,6 +70,7 @@
|
||||
#define SPACING 5
|
||||
#define MARGIN 10
|
||||
|
||||
|
||||
enum { EDGE = 0, FACE, VOLUME };
|
||||
|
||||
/*!
|
||||
@ -114,7 +115,10 @@ QFrame* SMESHGUI_ShapeByMeshDlg::createMainFrame (QWidget* theParent)
|
||||
QLabel* anIdLabel = new QLabel( aMainGrp, "element id label");
|
||||
anIdLabel->setText( tr("ELEMENT_ID") );
|
||||
myElementId = new QLineEdit( aMainGrp, "element id");
|
||||
myElementId->setValidator( new SMESHGUI_IdValidator( theParent, "id validator", 1 ));
|
||||
if (!myIsMultipleAllowed)
|
||||
myElementId->setValidator( new SMESHGUI_IdValidator( theParent, "id validator", 1 ));
|
||||
else
|
||||
myElementId->setValidator( new SMESHGUI_IdValidator( theParent, "id validator" ));
|
||||
|
||||
// shape name
|
||||
QLabel* aNameLabel = new QLabel( aMainGrp, "geom name label");
|
||||
@ -148,12 +152,14 @@ SMESHGUI_ShapeByMeshDlg::~SMESHGUI_ShapeByMeshDlg()
|
||||
* Initialize operation
|
||||
*/
|
||||
//================================================================================
|
||||
SMESHGUI_ShapeByMeshOp::SMESHGUI_ShapeByMeshOp()
|
||||
SMESHGUI_ShapeByMeshOp::SMESHGUI_ShapeByMeshOp(bool isMultipleAllowed):
|
||||
myIsMultipleAllowed(isMultipleAllowed)
|
||||
{
|
||||
if ( GeometryGUI::GetGeomGen()->_is_nil() )// check that GEOM_Gen exists
|
||||
GeometryGUI::InitGeomGen();
|
||||
|
||||
myDlg = new SMESHGUI_ShapeByMeshDlg;
|
||||
myDlg->setMultipleAllowed(myIsMultipleAllowed);
|
||||
|
||||
connect(myDlg->myElemTypeGroup, SIGNAL(clicked(int)), SLOT(onTypeChanged(int)));
|
||||
connect(myDlg->myElementId, SIGNAL(textChanged(const QString&)), SLOT(onElemIdChanged(const QString&)));
|
||||
@ -282,9 +288,85 @@ void SMESHGUI_ShapeByMeshOp::commitOperation()
|
||||
{
|
||||
SMESHGUI_SelectionOp::commitOperation();
|
||||
try {
|
||||
int elemID = myDlg->myElementId->text().toInt();
|
||||
myGeomObj = SMESHGUI::GetSMESHGen()->GetGeometryByMeshElement
|
||||
( myMesh.in(), elemID, myDlg->myGeomName->text().latin1());
|
||||
QStringList aListId = QStringList::split( " ", myDlg->myElementId->text(), false);
|
||||
if (aListId.count() == 1)
|
||||
{
|
||||
int elemID = (aListId.first()).toInt();
|
||||
myGeomObj = SMESHGUI::GetSMESHGen()->GetGeometryByMeshElement
|
||||
( myMesh.in(), elemID, myDlg->myGeomName->text().latin1());
|
||||
}
|
||||
else
|
||||
{
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
|
||||
if (geomGen->_is_nil() || !aStudy)
|
||||
return;
|
||||
|
||||
GEOM::GEOM_IShapesOperations_var aShapesOp =
|
||||
geomGen->GetIShapesOperations(aStudy->StudyId());
|
||||
if (aShapesOp->_is_nil() )
|
||||
return;
|
||||
|
||||
TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
|
||||
|
||||
std::map<double, GEOM::GEOM_Object_var> aGeomObjectsMap;
|
||||
GEOM::GEOM_Object_var aGeomObject;
|
||||
|
||||
GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
|
||||
|
||||
for ( int i = 0; i < aListId.count(); i++ )
|
||||
{
|
||||
aGeomObject =
|
||||
SMESHGUI::GetSMESHGen()->FindGeometryByMeshElement(myMesh.in(), aListId[i].toInt());
|
||||
|
||||
if (aGeomObject->_is_nil()) continue;
|
||||
|
||||
double anId = aShapesOp->GetSubShapeIndex(aMeshShape, aGeomObject);
|
||||
if (aShapesOp->IsDone() && aGeomObjectsMap.find(anId) == aGeomObjectsMap.end())
|
||||
{
|
||||
aGeomObjectsMap[anId] = aGeomObject;
|
||||
|
||||
TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)aGeomObject->GetShapeType();
|
||||
if (i == 0)
|
||||
aGroupType = aSubShapeType;
|
||||
else if (aSubShapeType != aGroupType)
|
||||
aGroupType = TopAbs_SHAPE;
|
||||
}
|
||||
}
|
||||
|
||||
int aNumberOfGO = aGeomObjectsMap.size();
|
||||
if (aNumberOfGO == 1)
|
||||
myGeomObj = (*aGeomObjectsMap.begin()).second;
|
||||
else if (aNumberOfGO > 1)
|
||||
{
|
||||
GEOM::GEOM_IGroupOperations_var aGroupOp =
|
||||
geomGen->GetIGroupOperations(aStudy->StudyId());
|
||||
if(aGroupOp->_is_nil())
|
||||
return;
|
||||
|
||||
GEOM::ListOfGO_var aGeomObjects = new GEOM::ListOfGO();
|
||||
aGeomObjects->length( aNumberOfGO );
|
||||
|
||||
int i = 0;
|
||||
std::map<double, GEOM::GEOM_Object_var>::iterator anIter;
|
||||
for (anIter = aGeomObjectsMap.begin(); anIter!=aGeomObjectsMap.end(); anIter++)
|
||||
aGeomObjects[i++] = (*anIter).second;
|
||||
|
||||
//create geometry group
|
||||
myGeomObj = aGroupOp->CreateGroup(aMeshShape, aGroupType);
|
||||
aGroupOp->UnionList(myGeomObj, aGeomObjects);
|
||||
|
||||
if (!aGroupOp->IsDone())
|
||||
return;
|
||||
}
|
||||
|
||||
// publish the GEOM object in study
|
||||
QString aNewGeomGroupName ( myDlg->myGeomName->text().latin1() );
|
||||
|
||||
SALOMEDS::SObject_var aNewGroupSO =
|
||||
geomGen->AddInStudy(SMESHGUI::GetSMESHGen()->GetCurrentStudy(), myGeomObj, aNewGeomGroupName, aMeshShape);
|
||||
}
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
SalomeApp_Tools::QtCatchCorbaException(S_ex);
|
||||
@ -306,7 +388,7 @@ void SMESHGUI_ShapeByMeshOp::onSelectionDone()
|
||||
try {
|
||||
SALOME_ListIO aList;
|
||||
selectionMgr()->selectedObjects(aList, SVTK_Viewer::Type());
|
||||
if (aList.Extent() != 1)
|
||||
if (!myIsMultipleAllowed && aList.Extent() != 1)
|
||||
return;
|
||||
|
||||
SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(aList.First());
|
||||
@ -316,7 +398,9 @@ void SMESHGUI_ShapeByMeshOp::onSelectionDone()
|
||||
QString aString;
|
||||
int nbElems = SMESH::GetNameOfSelectedElements(selector(),//myViewWindow->GetSelector(),
|
||||
aList.First(), aString);
|
||||
if ( nbElems == 1 ) {
|
||||
if (nbElems > 0) {
|
||||
if (!myIsMultipleAllowed && nbElems != 1 )
|
||||
return;
|
||||
setElementID( aString );
|
||||
myDlg->setButtonEnabled( true, QtxDialog::OK );
|
||||
}
|
||||
@ -392,12 +476,16 @@ void SMESHGUI_ShapeByMeshOp::onElemIdChanged(const QString& theNewText)
|
||||
newIndices.Add( e->GetID() );
|
||||
}
|
||||
|
||||
if ( !newIndices.IsEmpty() && newIndices.Extent() == 1 )
|
||||
if ( SVTK_Selector* s = selector() ) {
|
||||
s->AddOrRemoveIndex( actor->getIO(), newIndices, false );
|
||||
viewWindow()->highlight( actor->getIO(), true, true );
|
||||
myDlg->setButtonEnabled( true, QtxDialog::OK );
|
||||
}
|
||||
if ( !newIndices.IsEmpty() )
|
||||
{
|
||||
if (!myIsMultipleAllowed && newIndices.Extent() != 1)
|
||||
return;
|
||||
if ( SVTK_Selector* s = selector() ) {
|
||||
s->AddOrRemoveIndex( actor->getIO(), newIndices, false );
|
||||
viewWindow()->highlight( actor->getIO(), true, true );
|
||||
myDlg->setButtonEnabled( true, QtxDialog::OK );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,10 @@ private:
|
||||
QLineEdit* myElementId;
|
||||
QLineEdit* myGeomName;
|
||||
|
||||
private:
|
||||
bool myIsMultipleAllowed;
|
||||
void setMultipleAllowed(bool isAllowed) {myIsMultipleAllowed = isAllowed;};
|
||||
|
||||
// QPushButton* myOkBtn;
|
||||
// QPushButton* myCloseBtn;
|
||||
|
||||
@ -89,7 +93,7 @@ class SMESHGUI_ShapeByMeshOp: public SMESHGUI_SelectionOp
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SMESHGUI_ShapeByMeshOp();
|
||||
SMESHGUI_ShapeByMeshOp(bool isMultipleAllowed = false);
|
||||
virtual ~SMESHGUI_ShapeByMeshOp();
|
||||
|
||||
virtual LightApp_Dialog* dlg() const;
|
||||
@ -144,6 +148,7 @@ private:
|
||||
|
||||
bool myIsManualIdEnter;
|
||||
bool myHasSolids;
|
||||
bool myIsMultipleAllowed;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1130,6 +1130,41 @@ SMESH_Gen_i::GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
|
||||
throw ( SALOME::SALOME_Exception )
|
||||
{
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
|
||||
GEOM::GEOM_Object_var geom = FindGeometryByMeshElement(theMesh, theElementID);
|
||||
if ( !geom->_is_nil() ) {
|
||||
GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh();
|
||||
GEOM::GEOM_Gen_var geomGen = GetGeomEngine();
|
||||
|
||||
// try to find the corresponding SObject
|
||||
GeomObjectToShape( geom ); // geom client remembers the found shape
|
||||
SALOMEDS::SObject_var SObj = ObjectToSObject( myCurrentStudy, geom.in() );
|
||||
if ( SObj->_is_nil() )
|
||||
// publish a new subshape
|
||||
SObj = geomGen->AddInStudy( myCurrentStudy, geom, theGeomName, mainShape );
|
||||
// return only published geometry
|
||||
if ( !SObj->_is_nil() )
|
||||
return geom._retn();
|
||||
}
|
||||
return GEOM::GEOM_Object::_nil();
|
||||
}
|
||||
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return geometrical object the given element is built on.
|
||||
* \param theMesh - the mesh the element is in
|
||||
* \param theElementID - the element ID
|
||||
* \retval GEOM::GEOM_Object_ptr - the found geom object
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
GEOM::GEOM_Object_ptr
|
||||
SMESH_Gen_i::FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
|
||||
CORBA::Long theElementID)
|
||||
throw ( SALOME::SALOME_Exception )
|
||||
{
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
if ( CORBA::is_nil( theMesh ) )
|
||||
THROW_SALOME_CORBA_EXCEPTION( "bad Mesh reference", SALOME::BAD_PARAM );
|
||||
|
||||
@ -1154,17 +1189,8 @@ SMESH_Gen_i::GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
|
||||
if ( !op->_is_nil() )
|
||||
geom = op->GetSubShape( mainShape, shapeID );
|
||||
}
|
||||
if ( !geom->_is_nil() ) {
|
||||
// try to find the corresponding SObject
|
||||
GeomObjectToShape( geom ); // geom client remembers the found shape
|
||||
SALOMEDS::SObject_var SObj = ObjectToSObject( myCurrentStudy, geom.in() );
|
||||
if ( SObj->_is_nil() )
|
||||
// publish a new subshape
|
||||
SObj = geomGen->AddInStudy( myCurrentStudy, geom, theGeomName, mainShape );
|
||||
// return only published geometry
|
||||
if ( !SObj->_is_nil() )
|
||||
return geom._retn();
|
||||
}
|
||||
if ( !geom->_is_nil() )
|
||||
return geom._retn();
|
||||
}
|
||||
}
|
||||
return GEOM::GEOM_Object::_nil();
|
||||
|
@ -229,12 +229,17 @@ public:
|
||||
const SMESH::object_array& theListOfSubShape )
|
||||
throw ( SALOME::SALOME_Exception );
|
||||
|
||||
// Return geometrical object the given element is built on
|
||||
// Return geometrical object the given element is built on. Publish it in study.
|
||||
GEOM::GEOM_Object_ptr GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
|
||||
CORBA::Long theElementID,
|
||||
const char* theGeomName)
|
||||
throw ( SALOME::SALOME_Exception );
|
||||
|
||||
// Return geometrical object the given element is built on. Don't publish it in study.
|
||||
GEOM::GEOM_Object_ptr FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
|
||||
CORBA::Long theElementID)
|
||||
throw ( SALOME::SALOME_Exception );
|
||||
|
||||
// ****************************************************
|
||||
// Interface inherited methods (from SALOMEDS::Driver)
|
||||
// ****************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user