_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
QStringList errors;
+ QStringList anEntryList;
bool isEmpty = false;
for ( QStringList::ConstIterator it = filenames.begin(); it != filenames.end(); ++it ) {
QString filename = *it;
if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import
SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() );
+ anEntryList.append( aMeshSO->GetID().c_str() );
+
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// update Object browser
SMESHGUI::GetSMESHGUI()->updateObjBrowser();
+ // browse to the published meshes
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList );
+
// show Error message box if there were errors
if ( errors.count() > 0 ) {
SUIT_MessageBox::critical( SMESHGUI::desktop(),
SMESH::long_array_var aVolumes = aSubMesh->GetElementsByType(SMESH::VOLUME);
// create group for each type o elements
QString aName = IObject->getName();
+ QStringList anEntryList;
if (aNodes->length() > 0) {
SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::NODE, aName + "_Nodes");
aGroup->Add(aNodes.inout());
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aGroup ) )
+ anEntryList.append( aSObject->GetID().c_str() );
}
if (aEdges->length() > 0) {
SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::EDGE, aName + "_Edges");
aGroup->Add(aEdges.inout());
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aGroup ) )
+ anEntryList.append( aSObject->GetID().c_str() );
}
if (aFaces->length() > 0) {
SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::FACE, aName + "_Faces");
aGroup->Add(aFaces.inout());
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aGroup ) )
+ anEntryList.append( aSObject->GetID().c_str() );
}
if (aVolumes->length() > 0) {
SMESH::SMESH_Group_var aGroup = SMESH::AddGroup(aMesh, SMESH::VOLUME, aName + "_Volumes");
aGroup->Add(aVolumes.inout());
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aGroup ) )
+ anEntryList.append( aSObject->GetID().c_str() );
}
updateObjBrowser();
-
+ anApp->browseObjects( anEntryList );
}
catch(const SALOME::SALOME_Exception & S_ex){
SalomeApp_Tools::QtCatchCorbaException(S_ex);
SMESHGUI_BuildCompoundDlg::SMESHGUI_BuildCompoundDlg( SMESHGUI* theModule )
: QDialog(SMESH::GetDesktop(theModule)),
mySMESHGUI(theModule),
- mySelectionMgr(SMESH::GetSelectionMgr(theModule))
+ mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
+ myIsApplyAndClose( false )
{
setModal(false);
setAttribute(Qt::WA_DeleteOnClose, true);
if (!myMesh->_is_nil()) {
QStringList aParameters;
aParameters << (CheckBoxMerge->isChecked() ? SpinBoxTol->text() : QString(" "));
+ QStringList anEntryList;
try {
SUIT_OverrideCursor aWaitCursor;
aCompoundMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
- SMESH::SetName( SMESH::FindSObject( aCompoundMesh ), LineEditName->text() );
+ _PTR(SObject) aSO = SMESH::FindSObject( aCompoundMesh );
+ if( aSO ) {
+ SMESH::SetName( aSO, LineEditName->text() );
+ anEntryList.append( aSO->GetID().c_str() );
+ }
mySMESHGUI->updateObjBrowser();
} catch(...) {
return false;
SMESH::DisplayActor(SMESH::GetActiveWindow(), anActor);
}// end IPAL21468
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList, isApplyAndClose() );
+
SMESHGUI::Modified();
#ifdef WITHGENERICOBJ
//=================================================================================
void SMESHGUI_BuildCompoundDlg::ClickOnOk()
{
+ setIsApplyAndClose( true );
if (ClickOnApply())
ClickOnCancel();
}
}
return true;
}
+
+//================================================================
+// function : setIsApplyAndClose
+// Purpose : Set value of the flag indicating that the dialog is
+// accepted by Apply & Close button
+//================================================================
+void SMESHGUI_BuildCompoundDlg::setIsApplyAndClose( const bool theFlag )
+{
+ myIsApplyAndClose = theFlag;
+}
+
+//================================================================
+// function : isApplyAndClose
+// Purpose : Get value of the flag indicating that the dialog is
+// accepted by Apply & Close button
+//================================================================
+bool SMESHGUI_BuildCompoundDlg::isApplyAndClose() const
+{
+ return myIsApplyAndClose;
+}
void keyPressEvent( QKeyEvent* );
bool isValid();
+
+ void setIsApplyAndClose( const bool theFlag );
+ bool isApplyAndClose() const;
private:
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
QString myHelpFileName;
+ bool myIsApplyAndClose;
+
private slots:
void ClickOnOk();
void ClickOnCancel();
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
myFilterDlg(0),
- mySelectedObject(SMESH::SMESH_IDSource::_nil())
+ mySelectedObject(SMESH::SMESH_IDSource::_nil()),
+ myIsApplyAndClose( false )
{
QPixmap image (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_COPY_MESH")));
if( !isValid() )
return false;
+ QStringList anEntryList;
try
{
SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_Gen_var gen = SMESHGUI::GetSMESHGen();
SMESH::SMESH_Mesh_var newMesh =
gen->CopyMesh(aPartToCopy, meshName.constData(), toCopyGroups, toKeepIDs);
+ if( !newMesh->_is_nil() )
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( newMesh ) )
+ anEntryList.append( aSObject->GetID().c_str() );
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
mySMESHGUI->updateObjBrowser(true);
SMESHGUI::Modified();
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList, isApplyAndClose() );
+
Init(false);
mySelectedObject = SMESH::SMESH_IDSource::_nil();
SelectionIntoArgument();
//=================================================================================
void SMESHGUI_CopyMeshDlg::ClickOnOk()
{
+ setIsApplyAndClose( true );
if( ClickOnApply() )
ClickOnCancel();
}
myFilterDlg->show();
}
+
+//================================================================
+// function : setIsApplyAndClose
+// Purpose : Set value of the flag indicating that the dialog is
+// accepted by Apply & Close button
+//================================================================
+void SMESHGUI_CopyMeshDlg::setIsApplyAndClose( const bool theFlag )
+{
+ myIsApplyAndClose = theFlag;
+}
+
+//================================================================
+// function : isApplyAndClose
+// Purpose : Get value of the flag indicating that the dialog is
+// accepted by Apply & Close button
+//================================================================
+bool SMESHGUI_CopyMeshDlg::isApplyAndClose() const
+{
+ return myIsApplyAndClose;
+}
bool isValid();
+ void setIsApplyAndClose( const bool theFlag );
+ bool isApplyAndClose() const;
+
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
SMESHGUI_IdValidator* myIdValidator;
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
QString myHelpFileName;
+ bool myIsApplyAndClose;
+
private slots:
void ClickOnOk();
void ClickOnCancel();
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
myIsBusy( false ),
- myNameChanged( false )
+ myNameChanged( false ),
+ myIsApplyAndClose( false )
{
initDialog( true );
if ( !theMesh->_is_nil() )
if (myName->text().trimmed().isEmpty())
return false;
+ bool anIsOk = false;
+ QStringList anEntryList;
if (myGrpTypeId == 0) { // on mesh elements
if (!mySelectAll->isChecked() && !myElements->count())
return false;
myGroup->SetColor(aColor);
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroup);
+ if( aMeshGroupSO )
+ anEntryList.append( aMeshGroupSO->GetID().c_str() );
//SMESH::setFileName ( aMeshGroupSO, QString::number(myColorSpinBox->value()) );
SMESH::setFileType ( aMeshGroupSO, "COULEURGROUP" );
mySMESHGUI->updateObjBrowser(true);
SMESH::UpdateView(); // asv: fix of BUG PAL5515
mySelectionMgr->clearSelected();
- return true;
+ anIsOk = true;
}
else if (myGrpTypeId == 1) { // on geom object
if (CORBA::is_nil(myGroupOnGeom)) { // creation
myGroupOnGeom->SetColor(aColor);
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroupOnGeom);
+ if( aMeshGroupSO )
+ anEntryList.append( aMeshGroupSO->GetID().c_str() );
//SMESH::setFileName ( aMeshGroupSO, QString::number(myColorSpinBox->value()) );
SMESH::setFileType ( aMeshGroupSO,"COULEURGROUP" );
SMESHGUI::Modified();
mySMESHGUI->updateObjBrowser(true);
mySelectionMgr->clearSelected();
- return true;
+ anIsOk = true;
}
- return false;
+ if( anIsOk )
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ myObjectToSelect = anApp->browseObjects( anEntryList, isApplyAndClose() );
+
+ return anIsOk;
}
//=================================================================================
//=================================================================================
void SMESHGUI_GroupDlg::onOK()
{
+ setIsApplyAndClose( true );
if ( onApply() )
onClose();
+ setIsApplyAndClose( false );
}
//=================================================================================
restoreShowEntityMode();
}
- mySelectionMgr->clearSelected();
+ if( isApplyAndClose() && !myObjectToSelect.isEmpty() ) {
+ SUIT_DataOwnerPtrList aList;
+ aList.append( new LightApp_DataOwner( myObjectToSelect ) );
+ mySelectionMgr->setSelected( aList );
+ }
+ else
+ mySelectionMgr->clearSelected();
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->clearFilters();
return aViewWindow->isVisible(theActor->getIO());
return false;
}
+
+//================================================================
+//function : setIsApplyAndClose
+//purpose : Set value of the flag indicating that the dialog is
+// accepted by Apply & Close button
+//================================================================
+void SMESHGUI_GroupDlg::setIsApplyAndClose( const bool theFlag )
+{
+ myIsApplyAndClose = theFlag;
+}
+
+//================================================================
+//function : isApplyAndClose
+//purpose : Get value of the flag indicating that the dialog is
+// accepted by Apply & Close button
+//================================================================
+bool SMESHGUI_GroupDlg::isApplyAndClose() const
+{
+ return myIsApplyAndClose;
+}
QColor getGroupQColor() const;
void setDefaultGroupColor();
+
+ void setIsApplyAndClose( const bool theFlag );
+ bool isApplyAndClose() const;
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
QMap<QAction*, int> myActions;
bool myNameChanged; //added by skl for IPAL19574
+
+ QString myObjectToSelect;
+ bool myIsApplyAndClose;
};
#endif // SMESHGUI_GROUPDLG_H
#include <SUIT_Session.h>
#include <SUIT_OverrideCursor.h>
+#include <LightApp_Application.h>
#include <LightApp_UpdateFlags.h>
#include <SUIT_ResourceMgr.h>
// create groups
SMESH::SMESH_GroupOnGeom_var group;
+ QStringList anEntryList;
for ( int isNode = 0; isNode < 2; ++isNode ) // elems and then nodes
{
QStringList::iterator geomID = isNode ? myNodeGeoIDs.begin() : myElemGeoIDs.begin();
//printf( "apply() %s %s\n", (*geomID).latin1(), name.latin1() );
group = mesh->CreateGroupFromGEOM( elemType, name.toLatin1().data(), geom );
+ if( !group->_is_nil() )
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( group ) )
+ anEntryList.append( aSObject->GetID().c_str() );
}
}
SMESHGUI::Modified();
myDlg->myNodeGeomBtn->setChecked(false);
myDlg->updateButtons();
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList, isApplyAndClose() );
+
return !group->_is_nil();
}
#include <SVTK_ViewWindow.h>
#include <SALOME_ListIO.hxx>
+// SALOME KERNEL includes
+#include <SALOMEDSClient_SObject.hxx>
+
// Qt includes
#include <QHBoxLayout>
#include <QVBoxLayout>
SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+ myIsApplyAndClose( false )
{
setModal(false);
*/
void SMESHGUI_GroupOpDlg::onOk()
{
+ setIsApplyAndClose( true );
if ( onApply() )
onClose();
+ setIsApplyAndClose( false );
}
/*!
return false;
}
+/*!
+ \brief Set value of the flag indicating that the dialog is
+ accepted by Apply & Close button
+ \param theFlag value of the flag
+ \sa isApplyAndClose()
+*/
+void SMESHGUI_GroupOpDlg::setIsApplyAndClose( const bool theFlag )
+{
+ myIsApplyAndClose = theFlag;
+}
+
+/*!
+ \brief Get value of the flag indicating that the dialog is
+ accepted by Apply & Close button
+ \return value of the flag
+ \sa setApplyAndClose()
+*/
+bool SMESHGUI_GroupOpDlg::isApplyAndClose() const
+{
+ return myIsApplyAndClose;
+}
+
// === === === === === === === === === === === === === === === === === === === === ===
/*!
QString aName = getName();
bool aRes = false;
+ QStringList anEntryList;
try
{
SMESH::ListOfGroups_var aList = convert( myGroups );
if ( !CORBA::is_nil( aNewGrp ) )
{
aNewGrp->SetColor( getColor() );
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aNewGrp ) )
+ anEntryList.append( aSObject->GetID().c_str() );
aRes = true;
}
}
SMESHGUI::Modified();
getSMESHGUI()->updateObjBrowser(true);
reset();
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList, isApplyAndClose() );
return true;
}
else
QString aName = getName();
bool aRes = false;
+ QStringList anEntryList;
try
{
SMESH::ListOfGroups_var aList = convert( myGroups );
if ( !CORBA::is_nil( aNewGrp ) )
{
aNewGrp->SetColor( getColor() );
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aNewGrp ) )
+ anEntryList.append( aSObject->GetID().c_str() );
aRes = true;
}
}
SMESHGUI::Modified();
getSMESHGUI()->updateObjBrowser(true);
reset();
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList, isApplyAndClose() );
return true;
}
else
QString aName = getName();
bool aRes = false;
+ QStringList anEntryList;
try
{
SMESH::ListOfGroups_var aList1 = convert( myGroups1 );
if ( !CORBA::is_nil( aNewGrp ) )
{
aNewGrp->SetColor( getColor() );
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aNewGrp ) )
+ anEntryList.append( aSObject->GetID().c_str() );
aRes = true;
}
}
SMESHGUI::Modified();
getSMESHGUI()->updateObjBrowser(true);
reset();
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList, isApplyAndClose() );
return true;
}
else
QString aName = getName();
bool aRes = false;
+ QStringList anEntryList;
try
{
SMESH::ListOfGroups_var aList = convert( myGroups );
if ( !CORBA::is_nil( aNewGrp ) )
{
aNewGrp->SetColor( getColor() );
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aNewGrp ) )
+ anEntryList.append( aSObject->GetID().c_str() );
aRes = true;
}
}
SMESHGUI::Modified();
getSMESHGUI()->updateObjBrowser(true);
reset();
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList, isApplyAndClose() );
return true;
}
else
SALOMEDS::Color getColor() const;
+ void setIsApplyAndClose( const bool theFlag );
+ bool isApplyAndClose() const;
+
private:
void closeEvent( QCloseEvent* );
void enterEvent( QEvent* );
SVTK_Selector* mySelector;
QString myHelpFileName;
+
+ bool myIsApplyAndClose;
};
/*
#include "SMESH_LogicalFilter.hxx"
// SALOME GUI includes
+#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <LightApp_UpdateFlags.h>
#include <SALOME_ListIO.hxx>
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h>
+#include <SUIT_Session.h>
#include <SVTK_ViewModel.h>
#include <SalomeApp_Study.h>
#include <SalomeApp_Tools.h>
return true;
}
-bool SMESHGUI_Make2DFrom3DOp::compute2DMesh()
+bool SMESHGUI_Make2DFrom3DOp::compute2DMesh( QStringList& theEntryList )
{
SUIT_OverrideCursor wc;
tr("SMESH_INFORMATION"),
tr("NB_ADDED").arg( nbAdded ));
if ( !newMesh->_is_nil() ) {
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( newMesh ) )
+ theEntryList.append( aSObject->GetID().c_str() );
#ifdef WITHGENERICOBJ
newMesh->UnRegister();
#endif
return false;
}
+ QStringList anEntryList;
bool res = false;
try {
- res = compute2DMesh();
+ res = compute2DMesh( anEntryList );
}
catch ( const SALOME::SALOME_Exception& S_ex ) {
SalomeApp_Tools::QtCatchCorbaException( S_ex );
if ( res ) {
SMESHGUI::Modified();
update( UF_ObjBrowser | UF_Model );
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList, isApplyAndClose() );
myDlg->setNewMeshName( SMESH::UniqueName( "Mesh_1" ) );
myDlg->setGroupName( SMESH::UniqueName( "Group" ) );
}
void onModeChanged();
private:
- bool compute2DMesh();
+ bool compute2DMesh( QStringList& );
private:
SMESH::SMESH_Mesh_var mySrcMesh;
// SALOME GUI includes
#include <SalomeApp_Tools.h>
#include <SalomeApp_Application.h>
+#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <LightApp_UpdateFlags.h>
#include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h>
+#include <SUIT_Session.h>
#include <SALOME_InteractiveObject.hxx>
#include <SALOME_ListIO.hxx>
aMess = "";
try
{
+ QStringList anEntryList;
if ( myToCreate && myIsMesh )
- aResult = createMesh( aMess );
+ aResult = createMesh( aMess, anEntryList );
if ( myToCreate && !myIsMesh )
- aResult = createSubMesh( aMess );
+ aResult = createSubMesh( aMess, anEntryList );
else if ( !myToCreate )
aResult = editMeshOrSubMesh( aMess );
if ( aResult )
{
SMESHGUI::Modified();
update( UF_ObjBrowser | UF_Model );
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ myObjectToSelect = anApp->browseObjects( anEntryList, isApplyAndClose() );
}
}
catch ( const SALOME::SALOME_Exception& S_ex )
selectionDone();
myIgnoreAlgoSelection = false;
+
+ myObjectToSelect.clear();
+}
+
+//=================================================================================
+/*!
+ * \brief Selects a recently created mesh or sub-mesh if necessary
+ *
+ * Virtual method redefined from base class called when operation is commited
+ * selects a recently created mesh or sub-mesh if necessary. Allows to perform
+ * selection when the custom selection filters are removed.
+ */
+//=================================================================================
+void SMESHGUI_MeshOp::commitOperation()
+{
+ SMESHGUI_SelectionOp::commitOperation();
+
+ if ( !myObjectToSelect.isEmpty() ) {
+ if ( LightApp_SelectionMgr* aSelectionMgr = selectionMgr() ) {
+ SUIT_DataOwnerPtrList aList;
+ aList.append( new LightApp_DataOwner( myObjectToSelect ) );
+ aSelectionMgr->setSelected( aList );
+ }
+ }
}
//================================================================================
/*!
* \brief Creates mesh
* \param theMess - Output parameter intended for returning error message
+ * \param theEntryList - List of entries of published objects
* \retval bool - TRUE if mesh is created, FALSE otherwise
*
* Creates mesh
*/
//================================================================================
-bool SMESHGUI_MeshOp::createMesh( QString& theMess )
+bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList )
{
theMess = "";
if ( aMeshVar->_is_nil() )
return false;
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshVar.in() );
- if ( aMeshSO )
+ if ( aMeshSO ) {
SMESH::SetName( aMeshSO, myDlg->objectText( SMESHGUI_MeshDlg::Obj ) );
+ theEntryList.append( aMeshSO->GetID().c_str() );
+ }
for ( int aDim = SMESH::DIM_0D; aDim <= SMESH::DIM_3D; aDim++ ) {
if ( !isAccessibleDim( aDim )) continue;
/*!
* \brief Creates sub-mesh
* \param theMess - Output parameter intended for returning error message
+ * \param theEntryList - List of entries of published objects
* \retval bool - TRUE if sub-mesh is created, FALSE otherwise
*
* Creates sub-mesh
*/
//================================================================================
-bool SMESHGUI_MeshOp::createSubMesh( QString& theMess )
+bool SMESHGUI_MeshOp::createSubMesh( QString& theMess, QStringList& theEntryList )
{
theMess = "";
// create sub-mesh
SMESH::SMESH_subMesh_var aSubMeshVar = aMeshVar->GetSubMesh( aGeomVar, aName.toLatin1().data() );
_PTR(SObject) aSubMeshSO = SMESH::FindSObject( aSubMeshVar.in() );
- if ( aSubMeshSO )
+ if ( aSubMeshSO ) {
SMESH::SetName( aSubMeshSO, aName.toLatin1().data() );
+ theEntryList.append( aSubMeshSO->GetID().c_str() );
+ }
for ( int aDim = SMESH::DIM_0D; aDim <= SMESH::DIM_3D; aDim++ )
{
protected:
virtual void startOperation();
+ virtual void commitOperation();
virtual void selectionDone();
virtual SUIT_SelectionFilter* createFilter( const int ) const;
virtual bool isValid( SUIT_Operation* ) const;
void createHypothesis( const int, const int,
const QString& );
- bool createMesh( QString& );
- bool createSubMesh( QString& );
+ bool createMesh( QString&, QStringList& );
+ bool createSubMesh( QString&, QStringList& );
bool editMeshOrSubMesh( QString& );
int currentHyp( const int, const int ) const;
bool myIgnoreAlgoSelection;
HypothesesSet* myHypoSet;
int myDim, myType;
+
+ QString myObjectToSelect;
};
#endif // SMESHGUI_MESHOP_H
// Purpose : Constructor
//=======================================================================
SMESHGUI_Operation::SMESHGUI_Operation()
-: LightApp_Operation()
+: LightApp_Operation(),
+ myIsApplyAndClose( false )
{
myHelpFileName = "";
}
//=======================================================================
void SMESHGUI_Operation::onOk()
{
+ setIsApplyAndClose( true );
if( onApply() )
commit();
+ setIsApplyAndClose( false );
//else
// abort();
}
{
}
+//================================================================
+// name : setIsApplyAndClose
+// Purpose : Set value of the flag indicating that the dialog is
+// accepted by Apply & Close button
+//================================================================
+void SMESHGUI_Operation::setIsApplyAndClose( const bool theFlag )
+{
+ myIsApplyAndClose = theFlag;
+}
+
+//================================================================
+// name : isApplyAndClose
+// Purpose : Get value of the flag indicating that the dialog is
+// accepted by Apply & Close button
+//================================================================
+bool SMESHGUI_Operation::isApplyAndClose() const
+{
+ return myIsApplyAndClose;
+}
+
/*!
* \brief Verifies whether study of operation is locked
* \param theMess - specifies whether message box must be shown if study is locked
virtual void startOperation();
virtual bool isReadyToStart() const;
+ virtual void setIsApplyAndClose( const bool theFlag );
+ virtual bool isApplyAndClose() const;
+
//! Set according dialog active or inactive
virtual void setDialogActive( const bool );
virtual bool isValid( SUIT_Operation* ) const;
QString myHelpFileName;
+ bool myIsApplyAndClose;
protected slots:
virtual void onOk();
//=================================================================================
SMESHGUI_PreviewDlg::SMESHGUI_PreviewDlg(SMESHGUI* theModule) :
mySMESHGUI(theModule),
- QDialog(SMESH::GetDesktop( theModule )) {
+ QDialog(SMESH::GetDesktop( theModule )),
+ myIsApplyAndClose( false )
+{
mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
}
void SMESHGUI_PreviewDlg::onDisplaySimulation(bool toDisplayPreview) {
//Empty implementation here
}
+
+//================================================================
+// Function : setIsApplyAndClose
+// Purpose : Set value of the flag indicating that the dialog is
+// accepted by Apply & Close button
+//================================================================
+void SMESHGUI_PreviewDlg::setIsApplyAndClose( const bool theFlag )
+{
+ myIsApplyAndClose = theFlag;
+}
+
+//================================================================
+// Function : isApplyAndClose
+// Purpose : Get value of the flag indicating that the dialog is
+// accepted by Apply & Close button
+//================================================================
+bool SMESHGUI_PreviewDlg::isApplyAndClose() const
+{
+ return myIsApplyAndClose;
+}
protected:
void connectPreviewControl();
+ virtual void setIsApplyAndClose( const bool theFlag );
+ virtual bool isApplyAndClose() const;
+
protected slots:
void toDisplaySimulation();
virtual void onDisplaySimulation( bool );
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
SMESHGUI_MeshEditPreview* mySimulation;
QCheckBox* myPreviewCheckBox;
+ bool myIsApplyAndClose;
};
#endif
int actionButton = ActionGroup->checkedId();
bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
+ QStringList anEntryList;
try {
SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
LineEditNewMesh->text().toLatin1().data());
if (!mesh->_is_nil()) {
mesh->SetParameters(aParameters.join(":").toLatin1().constData());
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
+ anEntryList.append( aSObject->GetID().c_str() );
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
SMESH::UpdateView();
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
- actionButton == MAKE_MESH_BUTTON )
+ actionButton == MAKE_MESH_BUTTON ) {
mySMESHGUI->updateObjBrowser(true); // new groups may appear
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList, isApplyAndClose() );
+ }
Init(false);
mySelectedObject = SMESH::SMESH_IDSource::_nil();
SelectionIntoArgument();
//=================================================================================
void SMESHGUI_RotationDlg::ClickOnOk()
{
+ setIsApplyAndClose( true );
if( ClickOnApply() )
ClickOnCancel();
}
int actionButton = ActionGroup->checkedId();
bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
+ QStringList anEntryList;
try {
SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
LineEditNewMesh->text().toLatin1().data());
if (!mesh->_is_nil()) {
mesh->SetParameters(aParameters.join(":").toLatin1().constData());
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
+ anEntryList.append( aSObject->GetID().c_str() );
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
SMESH::UpdateView();
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
- actionButton == MAKE_MESH_BUTTON )
+ actionButton == MAKE_MESH_BUTTON ) {
mySMESHGUI->updateObjBrowser(true); // new groups may appear
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList, isApplyAndClose() );
+ }
Init(false);
ConstructorsClicked(GetConstructorId());
mySelectedObject = SMESH::SMESH_IDSource::_nil();
//=================================================================================
void SMESHGUI_ScaleDlg::ClickOnOk()
{
+ setIsApplyAndClose( true );
if( ClickOnApply() )
ClickOnCancel();
}
int actionButton = ActionGroup->checkedId();
bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
-
+ QStringList anEntryList;
try {
SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
LineEditNewMesh->text().toLatin1().data());
if (!mesh->_is_nil()) {
mesh->SetParameters(aParameters.join(":").toLatin1().constData());
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
+ anEntryList.append( aSObject->GetID().c_str() );
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
SMESH::UpdateView();
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
- actionButton == MAKE_MESH_BUTTON )
+ actionButton == MAKE_MESH_BUTTON ) {
mySMESHGUI->updateObjBrowser(true); // new groups may appear
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList, isApplyAndClose() );
+ }
Init(false);
ConstructorsClicked(GetConstructorId());
mySelectedObject = SMESH::SMESH_IDSource::_nil();
//=================================================================================
void SMESHGUI_SymmetryDlg::ClickOnOk()
{
+ setIsApplyAndClose( true );
if( ClickOnApply() )
ClickOnCancel();
}
int actionButton = ActionGroup->checkedId();
bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
+ QStringList anEntryList;
try {
SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
LineEditNewMesh->text().toLatin1().data());
if (!mesh->_is_nil()) {
mesh->SetParameters(aParameters.join(":").toLatin1().constData());
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
+ anEntryList.append( aSObject->GetID().c_str() );
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
SMESH::UpdateView();
if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() ||
- actionButton == MAKE_MESH_BUTTON )
+ actionButton == MAKE_MESH_BUTTON ) {
mySMESHGUI->updateObjBrowser(true); // new groups may appear
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList, isApplyAndClose() );
+ }
+
Init(false);
ConstructorsClicked(GetConstructorId());
mySelectedObject = SMESH::SMESH_IDSource::_nil();
//=================================================================================
void SMESHGUI_TranslationDlg::ClickOnOk()
{
+ setIsApplyAndClose( true );
if( ClickOnApply() )
ClickOnCancel();
}